Main MRPT website > C++ reference for MRPT 1.5.6
Namespaces | Macros | Functions
memory.h File Reference
#include <mrpt/utils/core_defs.h>
#include <cstring>
Include dependency graph for memory.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 mrpt
 This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
 
 mrpt::system
 This namespace provides a OS-independent interface to many useful functions: filenames manipulation, time and date, string parsing, file I/O, threading, memory allocation, etc.
 
 mrpt::system::os
 This namespace provides a OS-independent interface to low-level functions.
 

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" - NOTICE: Since in some platforms alloca will be emulated with malloc, alloca_free MUST BE ALWAYS CALLED to avoid memory leaks. 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...
 
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
 

Functions

unsigned long BASE_IMPEXP mrpt::system::getMemoryUsage ()
 Returns the memory occupied by this process, in bytes. More...
 
void BASE_IMPEXPmrpt::system::os::aligned_malloc (size_t bytes, size_t alignment)
 Returns an aligned memory block. More...
 
voidmrpt::system::os::aligned_calloc (size_t bytes, size_t alignment)
 Identical to aligned_malloc, but it zeroes the reserved memory block. More...
 
void BASE_IMPEXPmrpt::system::os::aligned_realloc (void *old_ptr, size_t bytes, size_t alignment)
 Frees a memory block reserved by aligned_malloc. More...
 
void BASE_IMPEXP mrpt::system::os::aligned_free (void *p)
 Frees a memory block reserved by aligned_malloc. More...
 
template<typename _Tp >
_Tp * mrpt::system::os::align_ptr (_Tp *ptr, int n=(int) sizeof(_Tp))
 Returns a pointer a bit forward in memory so it's aligned for the given boundary size. More...
 
template<int bytes>
bool mrpt::system::is_aligned (const void *ptr)
 
template<>
bool mrpt::system::is_aligned< 8 > (const void *ptr)
 
template<>
bool mrpt::system::is_aligned< 16 > (const void *ptr)
 

Macro Definition Documentation

#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
Value:
void *operator new(size_t size) { return mrpt::system::os::aligned_malloc(size,16); } \
void *operator new[](size_t size){ return mrpt::system::os::aligned_malloc(size,16); } \
void operator delete(void * ptr) MRPT_NO_THROWS { mrpt::system::os::aligned_free(ptr); } \
void operator delete[](void * ptr) MRPT_NO_THROWS { mrpt::system::os::aligned_free(ptr); } \
/* in-place new and delete. since (at least afaik) there is no actual */ \
/* memory allocated we can safely let the default implementation handle */ \
/* this particular case. */ \
static void *operator new(size_t size, void *ptr) { return ::operator new(size,ptr); } \
void operator delete(void * memory, void *ptr) MRPT_NO_THROWS { return ::operator delete(memory,ptr); } \
/* nothrow-new (returns zero instead of std::bad_alloc) */ \
void* operator new(size_t size, const std::nothrow_t&) MRPT_NO_THROWS { try { return mrpt::system::os::aligned_malloc(size,16); } catch (...) { return 0; } } \
void operator delete(void *ptr, const std::nothrow_t&) MRPT_NO_THROWS { mrpt::system::os::aligned_free(ptr); }
GLvoid *typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1745
#define MRPT_NO_THROWS
C++11 noexcept: Used after member declarations.
GLsizeiptr size
Definition: glew.h:1586
void BASE_IMPEXP * aligned_malloc(size_t bytes, size_t alignment)
Returns an aligned memory block.
Definition: memory.cpp:37
void BASE_IMPEXP aligned_free(void *p)
Frees a memory block reserved by aligned_malloc.
Definition: memory.cpp:82

Definition at line 112 of file memory.h.




Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018