Falcon
|
Classes | |
class | PoolAllocator |
class | StackAllocator |
class | StackSTLAllocator |
class | STLAllocator |
Functions | |
void * | AllocateUnaligned (std::size_t sz_in_byte) |
void | Deallocate (void *memref) |
void * | AllocateAligned (std::size_t sz_in_byte, std::size_t alignment) |
void | DeallocateAligned (void *memref) |
template<typename T , typename... Args> | |
T * | fnew (Args... args) |
template<typename T , typename... Args> | |
T * | fnew_arr (std::size_t &count, Args... args) |
template<typename T , typename... Args> | |
T * | fnew_arr (unsigned count, Args... args) |
template<typename T > | |
void | fdelete (T *ptr) |
template<typename T > | |
void | fdelete (T *ptr, std::size_t &count) |
template<typename T , typename... Args> | |
T * | fnew_stack (Args... args) |
bool | MemoryManagerInit () |
bool | MeoryManagerShutDown () |
void * | Allocate (const std::size_t size) |
void | Free (void *ref, const std::size_t size) |
void * | AllocateOnStack (const std::size_t size) |
bool | FlushStack () |
template<class T , class U > | |
constexpr bool | operator== (const StackSTLAllocator< T > &, const StackSTLAllocator< U > &) noexcept |
template<class T , class U > | |
constexpr bool | operator!= (const StackSTLAllocator< T > &, const StackSTLAllocator< U > &) noexcept |
template<class T , class U > | |
constexpr bool | operator== (const STLAllocator< T > &, const STLAllocator< U > &) noexcept |
template<class T , class U > | |
constexpr bool | operator!= (const STLAllocator< T > &, const STLAllocator< U > &) noexcept |
STL container constructors take in an allocators which they use to allocate memory for intenal object allocations. By defualt it uses, std::allocators. Following class provides similar interface which enables STL containers to use our custome allocators.Please use following link to understand std::allocator, https://en.cppreference.com/w/cpp/memory/allocator
All standard containers access these via std::allocators. Thus we don't need to override the construct and destroy methods. Construct creats object inplace with placement new and destroy method calls destructors for the same object without freeing the pointer. Please refer following link for details, https://en.cppreference.com/w/cpp/memory/allocator_traits
void * fmemory::Allocate | ( | const std::size_t | size | ) |
Gets you a memory block from available pool. If no pool can accomadate required size it'll create a block using standard memory functions.
size | size of required memory block |
void * fmemory::AllocateAligned | ( | std::size_t | sz_in_byte, |
std::size_t | alignment | ||
) |
Allocates aligned memory.
[in] | size_t | size in bytes |
[in] | size_t | alignment |
void * fmemory::AllocateOnStack | ( | const std::size_t | size | ) |
void * fmemory::AllocateUnaligned | ( | std::size_t | sz_in_byte | ) |
Allocates unaligned memory.
[in] | size_t | size in bytes |
void fmemory::Deallocate | ( | void * | memref | ) |
Deallocates unaligned memory.
[in] | void* | pointer to the memory |
void fmemory::DeallocateAligned | ( | void * | memref | ) |
Deallocates aligned memory.
[in] | void* | pointer to the memory |
void fmemory::fdelete | ( | T * | ptr | ) |
void fmemory::fdelete | ( | T * | ptr, |
std::size_t & | count | ||
) |
Deletes the array from memory.
pointer | to the array @count number of elements in the array |
bool fmemory::FlushStack | ( | ) |
T* fmemory::fnew | ( | Args... | args | ) |
Exposes allocation API to the outer world.
All | the parameters required for calling constructor |
T* fmemory::fnew_arr | ( | std::size_t & | count, |
Args... | args | ||
) |
Exposes allocation API to the outer world.
count | number of elements in the array by ref |
All | the parameters required for calling type constructor |
T* fmemory::fnew_arr | ( | unsigned | count, |
Args... | args | ||
) |
Exposes allocation API to the outer world.
count | number of elements in the array by value |
All | the parameters required for calling type constructor |
T* fmemory::fnew_stack | ( | Args... | args | ) |
Exposes allocation API to the outer world.
All | the parameters required for calling constructor |
void fmemory::Free | ( | void * | ref, |
const std::size_t | size | ||
) |
Frees the memory block
ref | pointer to the memory block |
size | size of object being deleted, helps find the pool |
bool fmemory::MemoryManagerInit | ( | ) |
Initiates the memory manager. Needs to be called before running any code which uses any fmemory features.
Setting up stackAllocator
Setting up pool allocators
bool fmemory::MeoryManagerShutDown | ( | ) |
Shuts down memory manager. Needs to be called at the end of engine's life cycle so as to make sure no memory leaks are present.
Deleting stack allocator
Deleting pool allocator
|
constexprnoexcept |
Compares two default allocators. Since default allocators are stateless, two default allocators are always equal. https://en.cppreference.com/w/cpp/memory/allocator/operator_cmp Always returns false.
|
constexprnoexcept |
Compares two default allocators. Since default allocators are stateless, two default allocators are always equal. https://en.cppreference.com/w/cpp/memory/allocator/operator_cmp Always returns false.
|
constexprnoexcept |
Compares two default allocators. Since default allocators are stateless, two default allocators are always equal. https://en.cppreference.com/w/cpp/memory/allocator/operator_cmp Always returns true.
|
constexprnoexcept |
Compares two default allocators. Since default allocators are stateless, two default allocators are always equal. https://en.cppreference.com/w/cpp/memory/allocator/operator_cmp Always returns true.