This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: little help with memory leak/management by the kernel/libg++/libc?


jairo19@interhosting.us wrote on 04/08/2008 01:41:07 PM:

>    Hola:
>
> This demo program I wrote shows how much memory the process is using (as
> given by the kernel /proc/self/status interface) before and after I
> request and free memory.
>
> So the issue is that as I request and free memory of different sizes,
> the process seems not to relinquish the full amount of requested memory.
> My real world program seems to have a small loss of approx 100Kb for
> almost each memory request/release cycle, and it needs to do this 500000
> times, so you can imagine that I am running out of memory, but the
> program is releasing all the memory it asks for. In both cases valgrind
> does not report any leaks.
>

Working as designed. You can read about malloc's internal design by reading
the comments in the source:

http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/malloc/malloc.c?cvsroot=glibc

You may be able to adjust things more to your liking using the mallopt
interface:

http://www.gnu.org/software/libc/manual/html_mono/libc.html#Malloc-Tunable-Parameters

Steven J. Munroe
Linux on Power Toolchain Architect
IBM Corporation, Linux Technology Center


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]