Re: [uCsimm] General memory problem

From: johan.hedin@fra.se
Date: Tue Dec 12 2000 - 07:33:30 EST


tom@cyberiansoftware.com wrote:

> There was some discussion very early after the release of the uCsimm
> about memory leaks in the malloc/free code. I don't know what the
> outcome ever was. Check the list archives, some people had some
> suggestions / solutions that could be done with that code within the
> libc library.
>
> Tomw

I had dynamic memory allocation problems over a year ago using the original
uCLinux/uCSimm kernel shiped with the CD from RT-Contrl. I beleve that the problem i
deep down in libc or in the kernel. You can do a wery simple program that use malloc
to allocate a piece of memory and then imediately free the memory with free. Both
calls work, but the allocated memory isn't freed and your program will eat up all
memory on the uCSimm.

I'm not skilled to do libc or kernel hacking my self but I think that someone should
take a looka at the malloc/free implementation in the uCLinux libc to see if there is
a problem or not.

Pice of code that eats memory:

int main(int argc, char *argv[])
{
  void *ptr;

  while (1)
  {
    ptr = malloc(1000);
    free(ptr);
    sleep(2);
  }
}

/ Johan

This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/



This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:39 EST