[Bug libc/10756] free doesn't free all memory alloced by memalign
phil dot pratt dot szeliga at gmail dot com
sourceware-bugzilla@sourceware.org
Sun Oct 11 15:04:00 GMT 2009
------- Additional Comments From phil dot pratt dot szeliga at gmail dot com 2009-10-11 15:04 -------
(In reply to comment #0)
Oops. the main line should be "int main(int argc, char * argv)" as usual.
This code originally came from the Cell BE Processor.
> free doesn't free all memory alloced by memalign. This is causing my
> program to run out of memory, even though I am freeing old memory.
> This bug exists in newlib too.
>
> code example:
> =======================================
> #include <malloc.h>
> #include <stdio.h>
>
> static void printMemUsage()
> {
> struct mallinfo mi;
> mi = mallinfo();
> printf("MemUsage: %d\n", mi.arena);
> }
>
> int main(unsigned long long spe_id, unsigned long long
> program_data_ea, unsigned long long env)
> {
> printMemUsage();
> void * dyn_mem = memalign(16, 65535);
> printMemUsage();
> free(dyn_mem);
> printMemUsage();
> return 0;
> }
> =====================================
> compile with:
> gcc main.c
> =====================================
> run:
> #./a.out
> MemUsage: 0
> MemUsage: 200704
> MemUsage: 135168
> #
--
http://sourceware.org/bugzilla/show_bug.cgi?id=10756
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the Glibc-bugs
mailing list