This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/10756] New: 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 14:57:43 -0000
- Subject: [Bug libc/10756] New: free doesn't free all memory alloced by memalign
- Reply-to: sourceware-bugzilla at sourceware dot org
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
#
--
Summary: free doesn't free all memory alloced by memalign
Product: glibc
Version: 2.9
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: phil dot pratt dot szeliga at gmail dot com
CC: glibc-bugs at sources dot redhat dot com
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.