Add setmalloctag calls to help find memory leaks.
[rsc] --rw-rw-r-- M 28433 glenda sys 617 Sep 19 07:19 sys/src/libmp/port/betomp.c
/n/sourcesdump/2005/0919/plan9/sys/src/libmp/port/betomp.c:9,16 -
/n/sourcesdump/2005/0920/plan9/sys/src/libmp/port/betomp.c:9,18
int m, s;
mpdigit x;
- if(b == nil)
+ if(b == nil){
b = mpnew(0);
+ setmalloctag(b, getcallerpc(&p));
+ }
// dump leading zeros
while(*p == 0 && n > 1){
[rsc] --rw-rw-r-- M 28433 glenda sys 2685 Sep 19 07:19 sys/src/libmp/port/mpaux.c
/n/sourcesdump/2005/0919/plan9/sys/src/libmp/port/mpaux.c:58,63 -
/n/sourcesdump/2005/0920/plan9/sys/src/libmp/port/mpaux.c:58,64
sysfatal("mpsetminbits: n < 0");
b = mallocz(sizeof(mpint), 1);
+ setmalloctag(b, getcallerpc(&n));
if(b == nil)
sysfatal("mpnew: %r");
n = DIGITS(n);
[rsc] --rw-rw-r-- M 28433 glenda sys 915 Sep 19 07:19 sys/src/libmp/port/mptobe.c
/n/sourcesdump/2005/0919/plan9/sys/src/libmp/port/mptobe.c:15,20 -
/n/sourcesdump/2005/0920/plan9/sys/src/libmp/port/mptobe.c:15,21
if(p == nil){
n = (b->top+1)*Dbytes;
p = malloc(n);
+ setmalloctag(p, getcallerpc(&b));
}
if(p == nil)
return -1;
|