mimalloc
mimalloc copied to clipboard
Negative numbers in the stats (v.2.24)
in our interactive server, the mem command will execute
size_t current = 0, peak = 0;
mi_process_info(nullptr, nullptr, nullptr, ¤t, &peak, nullptr, nullptr, nullptr);
and the mem full command does (pseudo-code)
ask each thread to execute:
mi_collect(false); mi_collect(true); mi_stats_merge();
return mi_stats_get_json
Here's a session, where we typed mem, mem full, mem all in a row (the server was running, but the entire test took less than 2 seconds).
# mem
{"current":"262270976", "peak":"1164668928", ...}
# mem full
[{
"version": 1,
"mimalloc_version": 224,
"process": {
"elapsed_msecs": 335944,
"user_msecs": 88246,
"system_msecs": 60148,
"page_faults": 3317,
"rss_current": 18446744073468309504, <====
"rss_peak": 1198329856,
"commit_current": 18446744073468309504, <====
"commit_peak": 979955712
},
"pages": { "total": 0, "peak": 0, "current": -14417 },
"reserved": { "total": 2554785792, "peak": 2554785792, "current": 2554785792 },
"committed": { "total": 1491464192, "peak": 979955712, "current": -241242112 }, <====
"reset": { "total": 0, "peak": 0, "current": 0 },
"purged": { "total": 1714290688, "peak": 1714290688, "current": 1714290688 },
"page_committed": { "total": 3145728, "peak": 1699856, "current": -2557365280 },
"pages_abandoned": { "total": 24, "peak": 24, "current": 8 },
"threads": { "total": 42, "peak": 37, "current": 37 },
"malloc_normal": { "total": 0, "peak": 0, "current": 0 },
"malloc_huge": { "total": 2262679552, "peak": 2262679552, "current": 2262679552 },
"malloc_requested": { "total": 0, "peak": 0, "current": 0 },
"mmap_calls": 40,
"commit_calls": 1447,
"reset_calls": 0,
"purge_calls": 1676,
"arena_count": 2,
"malloc_normal_count": 0,
"malloc_huge_count": 2450,
"malloc_guarded_count": 0,
"arena_rollback_count": 0,
"arena_purges": 25,
"pages_extended": 0,
"pages_retire": 0,
"page_searches": 0,
"segments": { "total": 51, "peak": 50, "current": 42 },
"segments_abandoned": { "total": 4, "peak": 4, "current": 1 },
...
"page_bins": [
{ "total": 0, "peak": 0, "current": 0, "block_size": 8, "page_size": 65536 },
{ "total": 0, "peak": 0, "current": -21, "block_size": 8, "page_size": 65536 },
{ "total": 0, "peak": 0, "current": -183, "block_size": 16, "page_size": 65536 },
{ "total": 0, "peak": 0, "current": 0, "block_size": 24, "page_size": 65536 },
{ "total": 0, "peak": 0, "current": -98, "block_size": 32, "page_size": 65536 },
...
]
}
# mem
{"current":"18446744072832557056", "peak":"1249579008"...}
so current was initially ok, it became negative after mi_collect (but we don't know if there is a causality relationship), and after it gets negative, it never resets.