| 579 | } |
| 580 | |
| 581 | size_t cbm_mem_allocator_committed(void) { |
| 582 | size_t commit = 0; |
| 583 | mi_process_info(NULL, NULL, NULL, NULL, NULL, &commit, NULL, NULL); |
| 584 | /* The statistic behind this is a signed counter merged per thread at |
| 585 | * thread exit; a process whose long-lived thread commits what its |
| 586 | * short-lived threads free reads it NEGATIVE, cast to size_t here. The |
| 587 | * daemon's query-leak soak reported 2^64 - 121 MB from the second sample |
| 588 | * on (Linux, 2026-09-14). A negative reading is no reading: report 0 so |
| 589 | * the charge falls back to the OS number instead of a 16 EB budget breach. */ |
| 590 | if (commit > (SIZE_MAX >> 1)) { |
| 591 | return 0; |
| 592 | } |
| 593 | return commit; |
| 594 | } |
| 595 | |
| 596 | static _Atomic size_t g_peak_charged; |
| 597 | static _Atomic size_t g_charged_for_tests; /* 0 = live reading */ |
no outgoing calls
no test coverage detected