/sys/lib/acid/leak requires /sys/src/libc/port/pool.$objtype.acid which is not present by default. The attached patch adds an acid target to /sys/src/libc/port/mkfile that generates pool.$objtype.acid and refers to it in leak(1). With the right pool.$objtype.acid file present and its usage documented, finding leaks in programs works. Here some leaks present in acme (NOTE how one can use the `src(addr)` printed by leak in an acid session to print to source of leak with some context): % leak -s acme|rc src(0x0020db61); // 18 src(0x0020db82); // 18 src(0x0020db95); // 18 src(0x0020dbc3); // 18 src(0x0020dbde); // 18 src(0x0020de5f); // 17 src(0x0020db70); // 17 src(0x0020ebbc); // 7 src(0x0020ebcb); // 7 src(0x0020ec39); // 7 src(0x0020ec1e); // 6 src(0x0020ebdd); // 5 src(0x0020ebf0); // 5 src(0x00221607); // 5 src(0x0022578c); // 5 src(0x002000cb); // 1 term% acid 1179 /proc/1179/text:amd64 plan 9 executable /sys/lib/acid/port /sys/lib/acid/amd64 acid: src(0x0020db61) /sys/src/cmd/acme/exec.c:343 338 return; 339 if(flag1 || et->w->body.file->ntext>1 || winclean(et->w, FALSE)){ 340 w = et->w; 341 name = getname(&w->body, argt, arg, narg, TRUE); 342 if(name && plumbsendfd >= 0){ >343 pm = emalloc(sizeof(Plumbmsg)); 344 pm->src = estrdup("acme"); 345 pm->dst = estrdup("close"); 346 pm->wdir = estrdup(name); 347 if(p = strrchr(pm->wdir, '/')) 348 *p = '\0'; acid: Looks like there are some small leaks in acme ☺. From: Igor Böhm Date: Thu, 04 Nov 2021 23:11:56 +0000 Subject: [PATCH] leak: document how to generate pool.$objtype.acid /sys/lib/acid/leak requires /sys/src/libc/port/pool.$objtype.acid which is not present by default. Add acid target to /sys/src/libc/port/mkfile that generates pool.$objtype.acid and refer to it in leak(1). --- diff ca73f673473457152d6f1b2e9030495f8dec5c49 2c38083b6c34c72b5417f29dc6002aa445212ae5 --- a/sys/man/1/leak Mon Nov 1 18:07:28 2021 +++ b/sys/man/1/leak Fri Nov 5 00:11:56 2021 @@ -218,7 +218,17 @@ .I kmem depend on the internal structure of the libc pool memory allocator (see -.IR pool (2)). +.IR pool (2)) +and require +.B /sys/src/libc/port/pool.$objtype.acid +to be present and generated from +.BR pool.c +as follows: +.IP +.EX +% cd /sys/src/libc/port && mk acid +.EE +.PP Since the ANSI/POSIX environment uses a different allocator, .I leak @@ -228,8 +238,5 @@ is not speedy, and .I acidleak can consume more memory than the process(es) being examined. -.PP -These commands require -.B /sys/src/libc/port/pool.acid -to be present and generated from -.BR pool.c . + + --- a/sys/src/libc/port/mkfile Mon Nov 1 18:07:28 2021 +++ b/sys/src/libc/port/mkfile Fri Nov 5 00:11:56 2021 @@ -127,3 +127,6 @@ pool.$objtype.acid Cheers, Igor