Main MRPT website > C++ reference for MRPT 1.9.9
Classes | Macros | Functions
Memory utilities (#include <mrpt/system/memory.h>)

Detailed Description

Classes

class  mrpt::system::CGenericMemoryPool< DATA_PARAMS, POOLABLE_DATA >
 A generic system for versatile memory pooling. More...
 

Macros

#define mrpt_alloca(nBytes)   ::malloc(nBytes)
 In platforms and compilers with support to "alloca", allocate a memory block on the stack; if alloca is not supported, it is emulated as a normal "malloc". More...
 
#define mrpt_alloca_free(mem_block)   free(mem_block)
 This method must be called to "free" each memory block allocated with "system::alloca": If the block was really allocated in the stack, no operation is actually performed, otherwise it will be freed from the heap. More...
 

Functions

unsigned long mrpt::system::getMemoryUsage ()
 Returns the memory occupied by this process, in bytes. More...
 
template<std::size_t alignment, typename T , typename = std::enable_if_t<std::is_pointer<T>::value>>
bool mrpt::system::is_aligned (T ptr)
 

Macro Definition Documentation

◆ mrpt_alloca

#define mrpt_alloca (   nBytes)    ::malloc(nBytes)

In platforms and compilers with support to "alloca", allocate a memory block on the stack; if alloca is not supported, it is emulated as a normal "malloc".

  • NOTICE: Since in some platforms alloca will be emulated with malloc, alloca_free MUST BE ALWAYS CALLED to avoid memory leaks. This method MUST BE a macro rather than a function in order to operate on the caller's stack.
    See also
    mrpt_alloca_free

Definition at line 41 of file memory.h.

◆ mrpt_alloca_free

#define mrpt_alloca_free (   mem_block)    free(mem_block)

This method must be called to "free" each memory block allocated with "system::alloca": If the block was really allocated in the stack, no operation is actually performed, otherwise it will be freed from the heap.

This method MUST BE a macro rather than a function in order to operate on the caller's stack.

See also
mrpt_alloca

Definition at line 59 of file memory.h.

Function Documentation

◆ getMemoryUsage()

unsigned long mrpt::system::getMemoryUsage ( )

◆ is_aligned()

template<std::size_t alignment, typename T , typename = std::enable_if_t<std::is_pointer<T>::value>>
bool mrpt::system::is_aligned ( ptr)

Definition at line 67 of file memory.h.




Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST