41 static inline void* allocateBytes(
size_t count)
43 void* ptr = malloc(count);
44#if defined(CEGUI_CUSTOM_ALLOCATORS_USAGE)
47 getAllocationSize(count);
52 static inline void deallocateBytes(
void* ptr)
54#if defined(CEGUI_CUSTOM_ALLOCATORS_USAGE)
60#elif defined(__linux__)
61 count = malloc_usable_size(ptr);
62#elif defined(__APPLE__)
63 count = malloc_size(ptr);
65 getAllocationSize((
size_t)0 - count);
78 return std::numeric_limits<size_t>::max();
81 static inline size_t getAllocationSize(
size_t adjust = 0)
83 static size_t allocationSize = 0;
85 return allocationSize;
86#if defined(CEGUI_CUSTOM_ALLOCATORS_USAGE)
88 _InterlockedExchangeAdd(
reinterpret_cast<long*
>(&allocationSize), adjust);
89#elif defined(_M_AMD64)
90 _InterlockedExchangeAdd64(
reinterpret_cast<long long*
>(&allocationSize), adjust);
91#elif defined(__GNUC__)
92 __sync_add_and_fetch(&allocationSize, adjust);
95 return allocationSize;