Mail Archives: djgpp/1993/10/12/07:31:56
Hello !
I have made a small program which is supposed to alloc
and free memory. The problem is that it dosen't free
the allocated memory at all.
#include <stdio.h>
#include <malloc.h>
void main ()
{
int c;
void *p;
c=0;
while (c<800)
{
printf ("malloc: %d bytes \n",c*10000);
p=malloc (c*10000);
memset (p,0xff,c*10000);
free (p);
getch ();
c+=100;
}
}
I compile the program using: gcc prog.c -Wall
Why is'nt the memory free'd ?
I use gcc 2.2.2
+---------------------------------------------------+
hli AT tekn DOT hj DOT se
Henric Linden
H|gskolan J|nk|ping / J|nk|ping University
P.O Box 1026
551 11 J|nk|ping, Sweden
+---------------------------------------------------+
- Raw text -