Re: FREE touble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



johny@xxxxxxxxxxxxxx writes:

 > i want to ask, why free function did not do properly as it expected
 > (happened in test_malloc.c), the usage memory (using malloc) still exist
 > please help me, i have another program it, doing malloc continously, and
 > free it when not needed, this happened several times,
 > after some looping, my memory become 0 free, and it got hang.i did some
 > investigation, and found there is something strange in free.
 > 
 > anyone got idea what happen and give me a solution?

I get the same results.  It's correct as far as I can see: in this
case malloc doesn't return the pages to the OS, and neither should it.
Finding and recycling pages is expensive and unneceesary.

But malloc does re-use the memory after free.  Change the defintion of
dodol to prove it:

typedef struct _dodol
{
        char abc[10000];
} dodol;

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux