| 475 | #if defined(USE_JEMALLOC) |
| 476 | |
| 477 | int zmalloc_get_allocator_info(size_t *allocated, |
| 478 | size_t *active, |
| 479 | size_t *resident) { |
| 480 | uint64_t epoch = 1; |
| 481 | size_t sz; |
| 482 | *allocated = *resident = *active = 0; |
| 483 | /* Update the statistics cached by mallctl. */ |
| 484 | sz = sizeof(epoch); |
| 485 | je_mallctl("epoch", &epoch, &sz, &epoch, sz); |
| 486 | sz = sizeof(size_t); |
| 487 | /* Unlike RSS, this does not include RSS from shared libraries and other non |
| 488 | * heap mappings. */ |
| 489 | je_mallctl("stats.resident", resident, &sz, NULL, 0); |
| 490 | /* Unlike resident, this doesn't not include the pages jemalloc reserves |
| 491 | * for re-use (purge will clean that). */ |
| 492 | je_mallctl("stats.active", active, &sz, NULL, 0); |
| 493 | /* Unlike zmalloc_used_memory, this matches the stats.resident by taking |
| 494 | * into account all allocations done by this process (not only zmalloc). */ |
| 495 | je_mallctl("stats.allocated", allocated, &sz, NULL, 0); |
| 496 | return 1; |
| 497 | } |
| 498 | |
| 499 | void set_jemalloc_bg_thread(int enable) { |
| 500 | /* let jemalloc do purging asynchronously, required when there's no traffic |
no test coverage detected