[uCsimm] apparent memory leak in stdio

From: David Beckemeyer (david@corp.earthlink.net)
Date: Mon Jul 17 2000 - 02:41:06 EDT


It appears that there is some kind of memory leak in the standard
I/O libc.

Compile and run the following simple program and you will see
that it grows indefinately until it consumes all uClinux memory
(takes many hours/days to finally crash the uCsimm). Can you
see anything wrong with this program? Has anyone else seen
this behavior? Is there a work-around/fix?

This is with 2.0.381pre5 (from Rt-Control CD).

----------------------------------------------------------------
#include <stdio.h>

main ()
{
  FILE *fp;
  int i;

  i = 0;
  for (;;)
    {
      i++;
      fp = fopen ("/var/memtst", "w");
      if (fp)
        {
          fprintf (fp, "%d\n", i);
          fclose (fp);
        }
      sleep (5);
    }
}
----------------------------------------------------------------
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