Very confused about malloc in Linux, Help!!!
Sat Oct 9 14:30:00 GMT 2010
On Sat, Oct 09, 2010 at 01:10:20PM +0000, Shigang Zan wrote:
> Now I have met a problem about my software in Linux. The memory usage kept increasing until no memory to use.
> I found that malloc will return many addresses higher than 0x40000000 when I requested memory using malloc, the addresses were not in heap area (below 0x40000000). I don't know why this scenario happened.
Larger allocations are not allocated in heap but using mmap().
> And it seemed many blocks (1020K 1024K ...) were created and until memory was exhausted by them.
> What can I do to found the root cause of this problem. I found many blocks had no content, but why system crote more and more blocks.
Are you freeing up your memory properly? Are you sure about that?
Check with valgrind that you have no leaks.
If you want to receive programming advice, it would be wise to:
* ask about it on some more general programming forum (comp.lang.c?
stackoverflow.com?); this does not appear to be a glibc-specific
* create a short standalone testcase demonstrating your problem
Petr "Pasky" Baudis
The true meaning of life is to plant a tree under whose shade
you will never sit.
More information about the Libc-help