9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] pool curalloc bug
@ 2015-02-26  2:38 mischief
  2015-02-26 22:27 ` mischief
  2015-03-02  8:06 ` erik quanstrom
  0 siblings, 2 replies; 5+ messages in thread
From: mischief @ 2015-02-26  2:38 UTC (permalink / raw)
  To: 9fans

does anyone care to take a stab at figuring out why mainmem->curalloc underflows? here's a c program to reproduce.

#include <u.h>
#include <libc.h>

/*

8c curalloc.c
8l curalloc.8
p=`{8.out >[2=1] | awk '{ print $2 }' | tr -d : }
echo '*mainmem' | acid -lpool $p

-> curalloc	4294967016

*/

void
domalloc(int n)
{
	int i;
	void **a;

	a = mallocz(n * sizeof(void*), 1);

	for(i = 0; i < n; i++){
		a[i] = malloc(1024*1024*5);
	}

	for(i = 0; i < n; i++){
		free(a[i]);
	}

	free(a);
}

void
main(int argc, char *argv[])
{
	ARGBEGIN{
	}ARGEND

	domalloc(2);
	abort();
}




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-02 10:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26  2:38 [9fans] pool curalloc bug mischief
2015-02-26 22:27 ` mischief
2015-03-02  8:06 ` erik quanstrom
2015-03-02 10:10   ` cinap_lenrek
2015-03-02 10:23   ` cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).