This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/10756] free doesn't free all memory alloced by memalign
- From: "phil dot pratt dot szeliga at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 11 Oct 2009 15:04:42 -0000
- Subject: [Bug libc/10756] free doesn't free all memory alloced by memalign
- References: <20091011145743.10756.phil.pratt.szeliga@gmail.com>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- 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.