mirror of
https://bitbucket.org/seefoe/src.git
synced 2026-07-28 23:15:46 -04:00
Merge branch 'testing' into cmake-profile-build
This commit is contained in:
@@ -16,47 +16,6 @@
|
||||
|
||||
static MemoryManager memoryManager __attribute__ ((init_priority (101)));
|
||||
|
||||
#define USE_LIBC_MALLOC_HOOKS 0
|
||||
|
||||
#if USE_LIBC_MALLOC_HOOKS
|
||||
extern "C"
|
||||
{
|
||||
void memoryManagerFreeHook(__malloc_ptr_t __ptr, __const __malloc_ptr_t)
|
||||
{
|
||||
delete[] (char *)__ptr;
|
||||
}
|
||||
|
||||
__malloc_ptr_t memoryManagerMallocHook(size_t __size, const __malloc_ptr_t)
|
||||
{
|
||||
return new char[__size];
|
||||
}
|
||||
|
||||
__malloc_ptr_t memoryManagerReallocHook(__malloc_ptr_t __ptr, size_t size, __const __malloc_ptr_t)
|
||||
{
|
||||
if(! __ptr)
|
||||
return new char[size];
|
||||
|
||||
return MemoryManager::reallocate(__ptr, size);
|
||||
}
|
||||
|
||||
__malloc_ptr_t memoryManagerMemAlignHook(size_t alignment, size_t size, __const __malloc_ptr_t)
|
||||
{
|
||||
DEBUG_FATAL(true, ("memalign not implemented!"));
|
||||
return new char[size];
|
||||
}
|
||||
|
||||
static void memoryManagerMallocInitializeHook(void)
|
||||
{
|
||||
__free_hook = memoryManagerFreeHook;
|
||||
__malloc_hook = memoryManagerMallocHook;
|
||||
__realloc_hook = memoryManagerReallocHook;
|
||||
__memalign_hook = memoryManagerMemAlignHook;
|
||||
}
|
||||
void (*__malloc_initialize_hook) (void) = memoryManagerMallocInitializeHook;
|
||||
}
|
||||
|
||||
#endif//USE_LIBC_MALLOC_HOOKS
|
||||
|
||||
// ======================================================================
|
||||
|
||||
void *operator new(size_t size, MemoryManagerNotALeak)
|
||||
|
||||
Reference in New Issue
Block a user