Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2005/0919/4

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


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;


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].