From: David Beckemeyer (david@bdt.com)
Date: Wed Jul 19 2000 - 20:39:08 EDT
I'm using uClinux with the Rt-control uCsimm. I posted on the uCsimm
list a problem with an apparent memory leak. It appears that munmap()
doesn't release memory acquired with mmap() (or there is a bug in the
libc malloc/free calls).
The following simple program demonstrates the problem and consumes
all memory under uClinux (2.0.381pre5 from Rt-Control CD):
----------------------------------------------------------------
#define MEMSIZ 512
extern char *malloc (int x);
main ()
{
char *p;
int i;
i = 0;
do
{
p = malloc (MEMSIZ);
if (p)
free (p);
i++;
sleep (5);
}
while (p);
printf ("failed after %d iterations\n", i);
perror ("malloc");
exit (1);
}
----------------------------------------------------------------
I actually hacked up a quick and dirty implementation of malloc/free
that grabs chunks from uClinux via mmap() and then carves them up.
This solved my problem. I posted that code to the uCsimm list.
I haven't heard much about the problem over there. Has anyone
else seen this? Is this a known behavior of mmap/munmap for
uClinix, a bug in malloc/free, or what?
I don't want to post the hack of malloc/free I wrote if this is a
"well duh" problem.
Thanks,
- david
This message resent by the uclinux-dev@uclinux.org list server http://www.uClinux.org/
This archive was generated by hypermail 2.1.4 : Thu Sep 19 2002 - 13:19:15 EDT