Skip to content

acl/core/ansi_allocator.h

#include "acl/core/ansi_allocator.h"

An allocator that uses the system malloc and free.

ansi_allocator

class ansi_allocator : public acl::iallocator

An ANSI allocator implementation. It uses the system malloc/free to manage memory as well as provides some debugging functionality to track memory leaks.

ansi_allocator::allocate

virtual void* allocate(size_t size, size_t alignment = k_default_alignment) override

Allocates memory with the specified size and alignment.

Parameters

  • size: Size in bytes to allocate.
  • alignment: Alignment to allocate the memory with.

ansi_allocator::deallocate

virtual void deallocate(void* ptr, size_t size) override

Deallocates previously allocated memory and releases it.

Parameters

  • ptr: A pointer to memory previously allocated or nullptr.
  • size: Size in bytes of the allocation. This will match the original size requested through allocate.