9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: mischief@9.offblast.org
To: 9fans@9fans.net
Subject: [9fans] pool curalloc bug
Date: Wed, 25 Feb 2015 21:38:15 -0500	[thread overview]
Message-ID: <411f4ed7862275a46cf5a477a3aff0c4@sigma.offblast.org> (raw)

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();
}




             reply	other threads:[~2015-02-26  2:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26  2:38 mischief [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=411f4ed7862275a46cf5a477a3aff0c4@sigma.offblast.org \
    --to=mischief@9.offblast.org \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).