Re: [uCsimm] simpler memory leak example

From: David Smead (smead@amplepower.com)
Date: Mon Jul 17 2000 - 16:31:38 EDT


David,

This looks like a case where malloc has to split larger buffers to deal
out one, but free isn't putting buffer fragments back together when it
can.

Sincerely,

David Smead
http://www.amplepower.com.
http://www.ampletech.com.

On Mon, 17 Jul 2000, David Beckemeyer wrote:

>
> Here's a simpler program that doesn't use stdio that consumes
> all system memory over time using malloc/free. With the sleep()
> call in there you can watch it consue memory (with ps). If you
> remove the sleep() call it will immediately hang/crash uClinux
> (uCsimm).
>
> Is this a known probklem? Is there a fix?
>
> This again is with 2.0.381pre5 (from the 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);
> }
> ----------------------------------------------------------------
> This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/
>

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:37 EST