[mercury-users] Debugging 'memory leaks' (fwd)
Ondrej Bojar
bojar at ufal.ms.mff.cuni.cz
Tue Apr 1 06:37:54 AEDT 2008
Peter Wang wrote:
>> but the heapsize never sinks, as show in the truncated log below.
>
> That's the normal behaviour without munmap, so unless the heap seems to
> keep growing without bound, I wouldn't worry about it.
I've investigated the issue with rotd-2008-03-27 and --boehm-gc-munmap,
and nothing is unmapped even in this case.
When checking memory usage using GC_get_heap_size a GC_get_free_bytes, I
can confirm that there is no leak as such. The estimated number of free
bytes grows significantly at expected places. The issue is heap size.
Unfortunately I have to worry about the heap size, because I run the
task on many machines with other users and other processes... I can
afford peaks in memusage from time to time, but I need to free it back
for others.
I have two guesses what needs a fix:
1. ./boehm_gc/os_dep.c: GC_unix_get_mem
When allocating memory, GC_unix_get_mem first try to do it using
sbrk. I have never allocated memory this way so I'm just guessing that
one cannot simply make holes in a process data segment by dealocating
bits of it. My guess is that GC_unix_mmap_get_mem should be preferred
with --boehm-gc-munmap
2. ./boehm_gc/allchblk.c: GC_freehblk
There is a FIXME remark at the end of the function that indicates a
problem with timestamps => no block would become old enough to munmap.
Before I delve deeper to figure out which of 1. and/or 2. indeed hold in
my case and try to tweak them without knowing much about the GC, I'd
like to hear your opinion. Can you rule out something right away?
Thanks, Ondrej.
>
>> I will try using --boehm-gc-munmap as soon as I get a recent ROTD compiled.
>>
>> Thanks!
>> Ondrej.
>
> Peter
>
> --------------------------------------------------------------------------
> mercury-users mailing list
> Post messages to: mercury-users at csse.unimelb.edu.au
> Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
> Subscriptions: mercury-users-request at csse.unimelb.edu.au
> --------------------------------------------------------------------------
--
Ondrej Bojar (mailto:obo at cuni.cz / bojar at ufal.mff.cuni.cz)
http://www.cuni.cz/~obo
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list