Add malloc logging tool

STATIC_YOINK("enable_memory_log");
This commit is contained in:
Justine Tunney 2022-05-26 23:17:19 -07:00
parent 7e9fb0a9f1
commit cb67223051
25 changed files with 502 additions and 78 deletions

View file

@ -163,9 +163,13 @@ static noasan int Munmap(char *p, size_t n) {
*/
noasan int munmap(void *p, size_t n) {
int rc;
size_t toto;
_spinlock(&_mmi.lock);
rc = Munmap(p, n);
#if SYSDEBUG
toto = __strace > 0 ? GetMemtrackSize(&_mmi) : 0;
#endif
_spunlock(&_mmi.lock);
STRACE("munmap(%.12p, %'zu) → %d% m", p, n, rc);
STRACE("munmap(%.12p, %'zu) → %d% m (%'zu bytes total)", p, n, rc, toto);
return rc;
}