mempool.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. /* Copyright (c) 2007-2008, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /* $Id$ */
  4. #if 1
  5. /* Tor dependencies */
  6. #include "orconfig.h"
  7. #endif
  8. #include <stdlib.h>
  9. #include <string.h>
  10. #define MEMPOOL_PRIVATE
  11. #include "mempool.h"
  12. /* OVERVIEW:
  13. *
  14. * This is an implementation of memory pools for Tor cells. It may be
  15. * useful for you too.
  16. *
  17. * Generally, a memory pool is an allocation strategy optimized for large
  18. * numbers of identically-sized objects. Rather than the elaborate arena
  19. * and coalescing strategies you need to get good performance for a
  20. * general-purpose malloc(), pools use a series of large memory "chunks",
  21. * each of which is carved into a bunch of smaller "items" or
  22. * "allocations".
  23. *
  24. * To get decent performance, you need to:
  25. * - Minimize the number of times you hit the underlying allocator.
  26. * - Try to keep accesses as local in memory as possible.
  27. * - Try to keep the common case fast.
  28. *
  29. * Our implementation uses three lists of chunks per pool. Each chunk can
  30. * be either "full" (no more room for items); "empty" (no items); or
  31. * "used" (not full, not empty). There are independent doubly-linked
  32. * lists for each state.
  33. *
  34. * CREDIT:
  35. *
  36. * I wrote this after looking at 3 or 4 other pooling allocators, but
  37. * without copying. The strategy this most resembles (which is funny,
  38. * since that's the one I looked at longest ago) is the pool allocator
  39. * underlying Python's obmalloc code. Major differences from obmalloc's
  40. * pools are:
  41. * - We don't even try to be threadsafe.
  42. * - We only handle objects of one size.
  43. * - Our list of empty chunks is doubly-linked, not singly-linked.
  44. * (This could change pretty easily; it's only doubly-linked for
  45. * consistency.)
  46. * - We keep a list of full chunks (so we can have a "nuke everything"
  47. * function). Obmalloc's pools leave full chunks to float unanchored.
  48. *
  49. * LIMITATIONS:
  50. * - Not even slightly threadsafe.
  51. * - Likes to have lots of items per chunks.
  52. * - One pointer overhead per allocated thing. (The alternative is
  53. * something like glib's use of an RB-tree to keep track of what
  54. * chunk any given piece of memory is in.)
  55. * - Only aligns allocated things to void* level: redefign ALIGNMENT_TYPE
  56. * if you need doubles.
  57. * - Could probably be optimized a bit; the representation contains
  58. * a bit more info than it really needs to have.
  59. * - probably, chunks should always be a power of 2.
  60. */
  61. #if 1
  62. /* Tor dependencies */
  63. #include "orconfig.h"
  64. #include "util.h"
  65. #include "compat.h"
  66. #include "log.h"
  67. #define ALLOC(x) tor_malloc(x)
  68. #define FREE(x) tor_free(x)
  69. #define ASSERT(x) tor_assert(x)
  70. #undef ALLOC_CAN_RETURN_NULL
  71. #define TOR
  72. //#define ALLOC_ROUNDUP(p) tor_malloc_roundup(p)
  73. /* End Tor dependencies */
  74. #else
  75. /* If you're not building this as part of Tor, you'll want to define the
  76. * following macros. For now, these should do as defaults.
  77. */
  78. #include <assert.h>
  79. #define PREDICT_UNLIKELY(x) (x)
  80. #define PREDICT_LIKELY(x) (x)
  81. #define ALLOC(x) malloc(x)
  82. #define FREE(x) free(x)
  83. #define STRUCT_OFFSET(tp, member) \
  84. ((off_t) (((char*)&((tp*)0)->member)-(char*)0))
  85. #define ASSERT(x) assert(x)
  86. #define ALLOC_CAN_RETURN_NULL
  87. #endif
  88. /* Tuning parameters */
  89. /** Largest type that we need to ensure returned memory items are aligned to.
  90. * Change this to "double" if we need to be safe for structs with doubles. */
  91. #define ALIGNMENT_TYPE void *
  92. /** Increment that we need to align allocated. */
  93. #define ALIGNMENT sizeof(ALIGNMENT_TYPE)
  94. /** Largest memory chunk that we should allocate. */
  95. #define MAX_CHUNK (8*(1L<<20))
  96. /** Smallest memory chunk size that we should allocate. */
  97. #define MIN_CHUNK 4096
  98. typedef struct mp_allocated_t mp_allocated_t;
  99. typedef struct mp_chunk_t mp_chunk_t;
  100. /** Holds a single allocated item, allocated as part of a chunk. */
  101. struct mp_allocated_t {
  102. /** The chunk that this item is allocated in. This adds overhead to each
  103. * allocated item, thus making this implementation inappropriate for
  104. * very small items. */
  105. mp_chunk_t *in_chunk;
  106. union {
  107. /** If this item is free, the next item on the free list. */
  108. mp_allocated_t *next_free;
  109. /** If this item is not free, the actual memory contents of this item.
  110. * (Not actual size.) */
  111. char mem[1];
  112. /** An extra element to the union to insure correct alignment. */
  113. ALIGNMENT_TYPE _dummy;
  114. } u;
  115. };
  116. /** 'Magic' value used to detect memory corruption. */
  117. #define MP_CHUNK_MAGIC 0x09870123
  118. /** A chunk of memory. Chunks come from malloc; we use them */
  119. struct mp_chunk_t {
  120. unsigned long magic; /**< Must be MP_CHUNK_MAGIC if this chunk is valid. */
  121. mp_chunk_t *next; /**< The next free, used, or full chunk in sequence. */
  122. mp_chunk_t *prev; /**< The previous free, used, or full chunk in sequence. */
  123. mp_pool_t *pool; /**< The pool that this chunk is part of. */
  124. /** First free item in the freelist for this chunk. Note that this may be
  125. * NULL even if this chunk is not at capacity: if so, the free memory at
  126. * next_mem has not yet been carved into items.
  127. */
  128. mp_allocated_t *first_free;
  129. int n_allocated; /**< Number of currently allocated items in this chunk. */
  130. int capacity; /**< Number of items that can be fit into this chunk. */
  131. size_t mem_size; /**< Number of usable bytes in mem. */
  132. char *next_mem; /**< Pointer into part of <b>mem</b> not yet carved up. */
  133. char mem[1]; /**< Storage for this chunk. (Not actual size.) */
  134. };
  135. /** Number of extra bytes needed beyond mem_size to allocate a chunk. */
  136. #define CHUNK_OVERHEAD (sizeof(mp_chunk_t)-1)
  137. /** Given a pointer to a mp_allocated_t, return a pointer to the memory
  138. * item it holds. */
  139. #define A2M(a) (&(a)->u.mem)
  140. /** Given a pointer to a memory_item_t, return a pointer to its enclosing
  141. * mp_allocated_t. */
  142. #define M2A(p) ( ((char*)p) - STRUCT_OFFSET(mp_allocated_t, u.mem) )
  143. #ifdef ALLOC_CAN_RETURN_NULL
  144. /** If our ALLOC() macro can return NULL, check whether <b>x</b> is NULL,
  145. * and if so, return NULL. */
  146. #define CHECK_ALLOC(x) \
  147. if (PREDICT_UNLIKELY(!x)) { return NULL; }
  148. #else
  149. /** If our ALLOC() macro can't return NULL, do nothing. */
  150. #define CHECK_ALLOC(x)
  151. #endif
  152. /** Helper: Allocate and return a new memory chunk for <b>pool</b>. Does not
  153. * link the chunk into any list. */
  154. static mp_chunk_t *
  155. mp_chunk_new(mp_pool_t *pool)
  156. {
  157. size_t sz = pool->new_chunk_capacity * pool->item_alloc_size;
  158. #ifdef ALLOC_ROUNDUP
  159. size_t alloc_size = CHUNK_OVERHEAD + sz;
  160. mp_chunk_t *chunk = ALLOC_ROUNDUP(&alloc_size);
  161. #else
  162. mp_chunk_t *chunk = ALLOC(CHUNK_OVERHEAD + sz);
  163. #endif
  164. CHECK_ALLOC(chunk);
  165. memset(chunk, 0, sizeof(mp_chunk_t)); /* Doesn't clear the whole thing. */
  166. chunk->magic = MP_CHUNK_MAGIC;
  167. #ifdef ALLOC_ROUNDUP
  168. chunk->mem_size = alloc_size - CHUNK_OVERHEAD;
  169. chunk->capacity = chunk->mem_size / pool->item_alloc_size;
  170. #else
  171. chunk->capacity = pool->new_chunk_capacity;
  172. chunk->mem_size = sz;
  173. #endif
  174. chunk->next_mem = chunk->mem;
  175. chunk->pool = pool;
  176. return chunk;
  177. }
  178. /** Return an newly allocated item from <b>pool</b>. */
  179. void *
  180. mp_pool_get(mp_pool_t *pool)
  181. {
  182. mp_chunk_t *chunk;
  183. mp_allocated_t *allocated;
  184. if (PREDICT_LIKELY(pool->used_chunks != NULL)) {
  185. /* Common case: there is some chunk that is neither full nor empty. Use
  186. * that one. (We can't use the full ones, obviously, and we should fill
  187. * up the used ones before we start on any empty ones. */
  188. chunk = pool->used_chunks;
  189. } else if (pool->empty_chunks) {
  190. /* We have no used chunks, but we have an empty chunk that we haven't
  191. * freed yet: use that. (We pull from the front of the list, which should
  192. * get us the most recently emptied chunk.) */
  193. chunk = pool->empty_chunks;
  194. /* Remove the chunk from the empty list. */
  195. pool->empty_chunks = chunk->next;
  196. if (chunk->next)
  197. chunk->next->prev = NULL;
  198. /* Put the chunk on the 'used' list*/
  199. chunk->next = pool->used_chunks;
  200. if (chunk->next)
  201. chunk->next->prev = chunk;
  202. pool->used_chunks = chunk;
  203. ASSERT(!chunk->prev);
  204. --pool->n_empty_chunks;
  205. if (pool->n_empty_chunks < pool->min_empty_chunks)
  206. pool->min_empty_chunks = pool->n_empty_chunks;
  207. } else {
  208. /* We have no used or empty chunks: allocate a new chunk. */
  209. chunk = mp_chunk_new(pool);
  210. CHECK_ALLOC(chunk);
  211. /* Add the new chunk to the used list. */
  212. chunk->next = pool->used_chunks;
  213. if (chunk->next)
  214. chunk->next->prev = chunk;
  215. pool->used_chunks = chunk;
  216. ASSERT(!chunk->prev);
  217. }
  218. ASSERT(chunk->n_allocated < chunk->capacity);
  219. if (chunk->first_free) {
  220. /* If there's anything on the chunk's freelist, unlink it and use it. */
  221. allocated = chunk->first_free;
  222. chunk->first_free = allocated->u.next_free;
  223. allocated->u.next_free = NULL; /* For debugging; not really needed. */
  224. ASSERT(allocated->in_chunk == chunk);
  225. } else {
  226. /* Otherwise, the chunk had better have some free space left on it. */
  227. ASSERT(chunk->next_mem + pool->item_alloc_size <=
  228. chunk->mem + chunk->mem_size);
  229. /* Good, it did. Let's carve off a bit of that free space, and use
  230. * that. */
  231. allocated = (void*)chunk->next_mem;
  232. chunk->next_mem += pool->item_alloc_size;
  233. allocated->in_chunk = chunk;
  234. allocated->u.next_free = NULL; /* For debugging; not really needed. */
  235. }
  236. ++chunk->n_allocated;
  237. if (PREDICT_UNLIKELY(chunk->n_allocated == chunk->capacity)) {
  238. /* This chunk just became full. */
  239. ASSERT(chunk == pool->used_chunks);
  240. ASSERT(chunk->prev == NULL);
  241. /* Take it off the used list. */
  242. pool->used_chunks = chunk->next;
  243. if (chunk->next)
  244. chunk->next->prev = NULL;
  245. /* Put it on the full list. */
  246. chunk->next = pool->full_chunks;
  247. if (chunk->next)
  248. chunk->next->prev = chunk;
  249. pool->full_chunks = chunk;
  250. }
  251. /* And return the memory portion of the mp_allocated_t. */
  252. return A2M(allocated);
  253. }
  254. /** Return an allocated memory item to its memory pool. */
  255. void
  256. mp_pool_release(void *item)
  257. {
  258. mp_allocated_t *allocated = (void*) M2A(item);
  259. mp_chunk_t *chunk = allocated->in_chunk;
  260. ASSERT(chunk);
  261. ASSERT(chunk->magic == MP_CHUNK_MAGIC);
  262. ASSERT(chunk->n_allocated > 0);
  263. allocated->u.next_free = chunk->first_free;
  264. chunk->first_free = allocated;
  265. if (PREDICT_UNLIKELY(chunk->n_allocated == chunk->capacity)) {
  266. /* This chunk was full and is about to be used. */
  267. mp_pool_t *pool = chunk->pool;
  268. /* unlink from the full list */
  269. if (chunk->prev)
  270. chunk->prev->next = chunk->next;
  271. if (chunk->next)
  272. chunk->next->prev = chunk->prev;
  273. if (chunk == pool->full_chunks)
  274. pool->full_chunks = chunk->next;
  275. /* link to the used list. */
  276. chunk->next = pool->used_chunks;
  277. chunk->prev = NULL;
  278. if (chunk->next)
  279. chunk->next->prev = chunk;
  280. pool->used_chunks = chunk;
  281. } else if (PREDICT_UNLIKELY(chunk->n_allocated == 1)) {
  282. /* This was used and is about to be empty. */
  283. mp_pool_t *pool = chunk->pool;
  284. /* Unlink from the used list */
  285. if (chunk->prev)
  286. chunk->prev->next = chunk->next;
  287. if (chunk->next)
  288. chunk->next->prev = chunk->prev;
  289. if (chunk == pool->used_chunks)
  290. pool->used_chunks = chunk->next;
  291. /* Link to the empty list */
  292. chunk->next = pool->empty_chunks;
  293. chunk->prev = NULL;
  294. if (chunk->next)
  295. chunk->next->prev = chunk;
  296. pool->empty_chunks = chunk;
  297. /* Reset the guts of this chunk to defragment it, in case it gets
  298. * used again. */
  299. chunk->first_free = NULL;
  300. chunk->next_mem = chunk->mem;
  301. ++pool->n_empty_chunks;
  302. }
  303. --chunk->n_allocated;
  304. }
  305. /** Allocate a new memory pool to hold items of size <b>item_size</b>. We'll
  306. * try to fit about <b>chunk_capacity</b> bytes in each chunk. */
  307. mp_pool_t *
  308. mp_pool_new(size_t item_size, size_t chunk_capacity)
  309. {
  310. mp_pool_t *pool;
  311. size_t alloc_size;
  312. pool = ALLOC(sizeof(mp_pool_t));
  313. CHECK_ALLOC(pool);
  314. memset(pool, 0, sizeof(mp_pool_t));
  315. /* First, we figure out how much space to allow per item. We'll want to
  316. * use make sure we have enough for the overhead plus the item size. */
  317. alloc_size = (size_t)(STRUCT_OFFSET(mp_allocated_t, u.mem) + item_size);
  318. /* If the item_size is less than sizeof(next_free), we need to make
  319. * the allocation bigger. */
  320. if (alloc_size < sizeof(mp_allocated_t))
  321. alloc_size = sizeof(mp_allocated_t);
  322. /* If we're not an even multiple of ALIGNMENT, round up. */
  323. if (alloc_size % ALIGNMENT) {
  324. alloc_size = alloc_size + ALIGNMENT - (alloc_size % ALIGNMENT);
  325. }
  326. if (alloc_size < ALIGNMENT)
  327. alloc_size = ALIGNMENT;
  328. ASSERT((alloc_size % ALIGNMENT) == 0);
  329. /* Now we figure out how many items fit in each chunk. We need to fit at
  330. * least 2 items per chunk. No chunk can be more than MAX_CHUNK bytes long,
  331. * or less than MIN_CHUNK. */
  332. if (chunk_capacity > MAX_CHUNK)
  333. chunk_capacity = MAX_CHUNK;
  334. /* Try to be around a power of 2 in size, since that's what allocators like
  335. * handing out. 512K-1 byte is a lot better than 512K+1 byte. */
  336. chunk_capacity = (size_t) round_to_power_of_2(chunk_capacity);
  337. while (chunk_capacity < alloc_size * 2 + CHUNK_OVERHEAD)
  338. chunk_capacity *= 2;
  339. if (chunk_capacity < MIN_CHUNK)
  340. chunk_capacity = MIN_CHUNK;
  341. pool->new_chunk_capacity = (chunk_capacity-CHUNK_OVERHEAD) / alloc_size;
  342. pool->item_alloc_size = alloc_size;
  343. log_debug(LD_MM, "Capacity is %lu, item size is %lu, alloc size is %lu",
  344. (unsigned long)pool->new_chunk_capacity,
  345. (unsigned long)pool->item_alloc_size,
  346. (unsigned long)(pool->new_chunk_capacity*pool->item_alloc_size));
  347. return pool;
  348. }
  349. /** If there are more than <b>n</b> empty chunks in <b>pool</b>, free the
  350. * excess ones that have been empty for the longest. (If <b>n</b> is less
  351. * than zero, free only empty chunks that were not used since the last
  352. * call to mp_pool_clean(), leaving only -<b>n</b>.) */
  353. void
  354. mp_pool_clean(mp_pool_t *pool, int n)
  355. {
  356. /* XXXX020 this is stupid. We shouldn't care about empty chunks if there
  357. * is lots of space in used chunks. */
  358. mp_chunk_t *chunk, **first_to_free;
  359. if (n < 0) {
  360. /* As said in the documentation, "negative n" means "leave an additional
  361. * -n chunks". So replace n with a positive number. */
  362. n = pool->min_empty_chunks + (-n);
  363. if (n < pool->n_empty_chunks)
  364. pool->min_empty_chunks = n;
  365. }
  366. ASSERT(n>=0);
  367. first_to_free = &pool->empty_chunks;
  368. while (*first_to_free && n > 0) {
  369. first_to_free = &(*first_to_free)->next;
  370. --n;
  371. }
  372. if (!*first_to_free)
  373. return;
  374. chunk = *first_to_free;
  375. while (chunk) {
  376. mp_chunk_t *next = chunk->next;
  377. chunk->magic = 0xdeadbeef;
  378. FREE(chunk);
  379. --pool->n_empty_chunks;
  380. chunk = next;
  381. }
  382. *first_to_free = NULL;
  383. }
  384. /** Helper: Given a list of chunks, free all the chunks in the list. */
  385. static void
  386. destroy_chunks(mp_chunk_t *chunk)
  387. {
  388. mp_chunk_t *next;
  389. while (chunk) {
  390. chunk->magic = 0xd3adb33f;
  391. next = chunk->next;
  392. FREE(chunk);
  393. chunk = next;
  394. }
  395. }
  396. /** Free all space held in <b>pool</b> This makes all pointers returned from
  397. * mp_pool_get(<b>pool</b>) invalid. */
  398. void
  399. mp_pool_destroy(mp_pool_t *pool)
  400. {
  401. destroy_chunks(pool->empty_chunks);
  402. destroy_chunks(pool->used_chunks);
  403. destroy_chunks(pool->full_chunks);
  404. memset(pool, 0xe0, sizeof(mp_pool_t));
  405. FREE(pool);
  406. }
  407. /** Helper: make sure that a given chunk list is not corrupt. */
  408. static int
  409. assert_chunks_ok(mp_pool_t *pool, mp_chunk_t *chunk, int empty, int full)
  410. {
  411. mp_allocated_t *allocated;
  412. int n = 0;
  413. if (chunk)
  414. ASSERT(chunk->prev == NULL);
  415. while (chunk) {
  416. n++;
  417. ASSERT(chunk->magic == MP_CHUNK_MAGIC);
  418. ASSERT(chunk->pool == pool);
  419. for (allocated = chunk->first_free; allocated;
  420. allocated = allocated->u.next_free) {
  421. ASSERT(allocated->in_chunk == chunk);
  422. }
  423. if (empty)
  424. ASSERT(chunk->n_allocated == 0);
  425. else if (full)
  426. ASSERT(chunk->n_allocated == chunk->capacity);
  427. else
  428. ASSERT(chunk->n_allocated > 0 && chunk->n_allocated < chunk->capacity);
  429. ASSERT(chunk->capacity == pool->new_chunk_capacity);
  430. ASSERT(chunk->mem_size ==
  431. pool->new_chunk_capacity * pool->item_alloc_size);
  432. ASSERT(chunk->next_mem >= chunk->mem &&
  433. chunk->next_mem <= chunk->mem + chunk->mem_size);
  434. if (chunk->next)
  435. ASSERT(chunk->next->prev == chunk);
  436. chunk = chunk->next;
  437. }
  438. return n;
  439. }
  440. /** Fail with an assertion if <b>pool</b> is not internally consistent. */
  441. void
  442. mp_pool_assert_ok(mp_pool_t *pool)
  443. {
  444. int n_empty;
  445. n_empty = assert_chunks_ok(pool, pool->empty_chunks, 1, 0);
  446. assert_chunks_ok(pool, pool->full_chunks, 0, 1);
  447. assert_chunks_ok(pool, pool->used_chunks, 0, 0);
  448. ASSERT(pool->n_empty_chunks == n_empty);
  449. }
  450. #ifdef TOR
  451. /** Dump information about <b>pool</b>'s memory usage to the Tor log at level
  452. * <b>severity</b>. */
  453. /*FFFF uses Tor logging functions. */
  454. void
  455. mp_pool_log_status(mp_pool_t *pool, int severity)
  456. {
  457. uint64_t bytes_used = 0;
  458. uint64_t bytes_allocated = 0;
  459. uint64_t bu = 0, ba = 0;
  460. mp_chunk_t *chunk;
  461. int n_full = 0, n_used = 0;
  462. ASSERT(pool);
  463. for (chunk = pool->empty_chunks; chunk; chunk = chunk->next) {
  464. bytes_allocated += chunk->mem_size;
  465. }
  466. log_fn(severity, LD_MM, U64_FORMAT" bytes in %d empty chunks",
  467. U64_PRINTF_ARG(bytes_used), pool->n_empty_chunks);
  468. for (chunk = pool->used_chunks; chunk; chunk = chunk->next) {
  469. ++n_used;
  470. bu += chunk->n_allocated * pool->item_alloc_size;
  471. ba += chunk->mem_size;
  472. }
  473. log_fn(severity, LD_MM, U64_FORMAT"/"U64_FORMAT
  474. " bytes in %d partially full chunks",
  475. U64_PRINTF_ARG(bu), U64_PRINTF_ARG(ba), n_used);
  476. bytes_used += bu;
  477. bytes_allocated += ba;
  478. bu = ba = 0;
  479. for (chunk = pool->full_chunks; chunk; chunk = chunk->next) {
  480. ++n_full;
  481. bu += chunk->n_allocated * pool->item_alloc_size;
  482. ba += chunk->mem_size;
  483. }
  484. log_fn(severity, LD_MM, U64_FORMAT"/"U64_FORMAT
  485. " bytes in %d full chunks",
  486. U64_PRINTF_ARG(bu), U64_PRINTF_ARG(ba), n_full);
  487. bytes_used += bu;
  488. bytes_allocated += ba;
  489. log_fn(severity, LD_MM, "Total: "U64_FORMAT"/"U64_FORMAT" bytes allocated "
  490. "for cell pools are full.",
  491. U64_PRINTF_ARG(bytes_used), U64_PRINTF_ARG(bytes_allocated));
  492. }
  493. #endif