One more type of memory leak is allocate memory, and redirect the pointer in
which it's accocated, to something else...
e.g.
{
int i;j;
int *a,*b;
a=(int *)malloc(100*sizeof(int));
if(!a)printf("\n No memory.. ");
a=&i;
}
Bye
Shridhar
On Wed, 30 Aug 2000, you wrote:
> Well, to put it in simple terms, memory leak is the memory that has been
> allocated, but cannot be used by the program or by the user.
> It might happen if you malloc some memory do not free it and then malloc
> again using the same pointer variable.
> Essentially, this memory is lost.
>
> Memory leak is critical if your program runs continuously, it may build up
> and after some time you will be left with no free memory.
>
> If you are a newbie, try using arrays instead of pointers, till you are
> comfortable with malloc/free/realloc.
>
> Also remember, "MEMORY THAT HAS BEEN ALLOCATED MUST BE FREED".
>
> Hope I have been informative.
>
> Regards,
> Amar :)
>
> --
> $=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=$
> My Home : http://www.crosswinds.net/~amargod
> http://amar.gnu-linux.net (for my Public Key)
> $=-=-=-=-=-=- L I N U X R U L E S ! -=-=-=-=-=-=-=$
>
> Your attitude in life always determines your altitude in life.
>
>
>
> ----------------------------------------------
> The mailing list archives are available at
> http://lists.linux-india.org/cgi-bin/wilma/LIH
----------------------------------------------
The mailing list archives are available at
http://lists.linux-india.org/cgi-bin/wilma/LIH