52 return ((size + _page_size - 1) / _page_size) * _page_size;
68#if defined(MEMORY_HOOK_DO_ALIGN)
69 uintptr_t *root = (uintptr_t *)ptr;
70 return (
size_t)root[-2];
71#elif defined(USE_MEMORY_DLMALLOC) || defined(USE_MEMORY_PTMALLOC2)
73 size_t *root = (
size_t *)ptr;
74 return (root[-1] & ~0x7) -
sizeof(size_t);
75#elif defined(DO_MEMORY_USAGE)
76 size_t *root = (
size_t *)((
char *)ptr - MEMORY_HOOK_ALIGNMENT);
static Integer add(Integer &var, Integer delta)
Atomically computes var += delta.
void inc_heap(size_t size)
Called by our alternative malloc implementations (dlmalloc and ptmalloc2) to indicate they have reque...
size_t round_up_to_page_size(size_t size) const
Rounds the indicated size request up to the next larger multiple of page_size, to qualify it for a ca...
static size_t get_ptr_size(void *ptr)
Given a pointer that was returned by a MemoryHook allocation, returns the number of bytes that were a...
void dec_heap(size_t size)
Called by our alternative malloc implementations (dlmalloc and ptmalloc2) to indicate they have retur...
size_t get_page_size() const
Returns the operating system page size.