caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] Manually triggering garbage collection
       [not found] <86F95E46-EF71-47F9-AE76-D765225CB597@inria.fr>
@ 2008-07-29 13:57 ` Damien Doligez
  2008-07-29 14:04   ` Jean Krivine
  0 siblings, 1 reply; 3+ messages in thread
From: Damien Doligez @ 2008-07-29 13:57 UTC (permalink / raw)
  To: caml users

On 2008-07-29, at 15:39, Jean Krivine wrote:

> OK great I' ll try,
> For the moment I just set a Gc alarm that detects whether memory usage
> is above a certain limit and if so, sets the overhead to 0, which
> stops completely the memory "leak".

Setting the overhead to 0 seems a bit overkill.  You might want to
do a Gc.compact() at this point.  Or you might just need to change
the max_overhead parameter: the lower it is, the more often the
GC will compact the heap.

> Do you think that would improve to increase the size of the major  
> heap?

Yes, sometimes it helps with fragmentation.  Also, increasing the
heap_increment may help.

> Also, do you know how often the alarm is tested? is it each time a
> major collection is performed?

The GC alarms are triggered at the end of each major collection.

-- Damien


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Manually triggering garbage collection
  2008-07-29 13:57 ` [Caml-list] Manually triggering garbage collection Damien Doligez
@ 2008-07-29 14:04   ` Jean Krivine
  0 siblings, 0 replies; 3+ messages in thread
From: Jean Krivine @ 2008-07-29 14:04 UTC (permalink / raw)
  To: Damien Doligez; +Cc: caml users

Well if I don't set the overhead to 0, there is still a slight "
innactive memory" accumulation. However, when the memory goes back to
a reasonable level, I set the overhead back to 80 (which is the
default value) using another alarm. The result of this is that
inactive memory wobbles continuously during the execution (it
accumulates at overhead 80 and decreases at overhead 0).

J

On Tue, Jul 29, 2008 at 9:57 AM, Damien Doligez <damien.doligez@inria.fr> wrote:
> On 2008-07-29, at 15:39, Jean Krivine wrote:
>
>> OK great I' ll try,
>> For the moment I just set a Gc alarm that detects whether memory usage
>> is above a certain limit and if so, sets the overhead to 0, which
>> stops completely the memory "leak".
>
> Setting the overhead to 0 seems a bit overkill.  You might want to
> do a Gc.compact() at this point.  Or you might just need to change
> the max_overhead parameter: the lower it is, the more often the
> GC will compact the heap.
>
>> Do you think that would improve to increase the size of the major heap?
>
> Yes, sometimes it helps with fragmentation.  Also, increasing the
> heap_increment may help.
>
>> Also, do you know how often the alarm is tested? is it each time a
>> major collection is performed?
>
> The GC alarms are triggered at the end of each major collection.
>
> -- Damien
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Manually triggering garbage collection
       [not found] ` <08F66ABF-5C25-4D49-8B0B-77B2F757C1DD@inria.fr>
@ 2008-07-29 13:39   ` Jean Krivine
  0 siblings, 0 replies; 3+ messages in thread
From: Jean Krivine @ 2008-07-29 13:39 UTC (permalink / raw)
  To: Damien Doligez, caml-list

OK great I' ll try,
For the moment I just set a Gc alarm that detects whether memory usage
is above a certain limit and if so, sets the overhead to 0, which
stops completely the memory "leak".
Do you think that would improve to increase the size of the major heap?
Also, do you know how often the alarm is tested? is it each time a
major collection is performed?

Thanks a lot
J

On Tue, Jul 29, 2008 at 8:53 AM, Damien Doligez <damien.doligez@inria.fr> wrote:
> Hello Jean,
>
> On 2008-07-26, at 21:15, Jean Krivine wrote:
>
>> I am running a memory intensive stochastic simulator written in ocaml.
>> After initialization of the data structure (which eats up a lot of
>> memory but that's normal) I observe a memory leak during the
>> simulation which should not be there.
>> I noticed that if I run Gc.major() every n computation events after
>> initialization (I can make n vary), then there is no more memory leak
>> (the memory the process is using is constant).
>>
>> So my question is the following:
>> Is there a rational way to detect I should call for Gc.Major()? (for
>> the moment I am triggering it every n events which is arbitrary)
>
>
> This might be a fragmentation problem, but if calling Gc.major()
> fixes it, I guess it's not a true leak (i.e. the memory would stabilize
> at some point).
>
> At any rate, you might want to try the CVS head version (3.11+dev):
> it uses first-fit allocation in order to fight fragmentation, and I'd
> like to know how well it does in the wild.
>
> -- Damien
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-29 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <86F95E46-EF71-47F9-AE76-D765225CB597@inria.fr>
2008-07-29 13:57 ` [Caml-list] Manually triggering garbage collection Damien Doligez
2008-07-29 14:04   ` Jean Krivine
2008-07-26 19:15 Jean Krivine
     [not found] ` <08F66ABF-5C25-4D49-8B0B-77B2F757C1DD@inria.fr>
2008-07-29 13:39   ` [Caml-list] " Jean Krivine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).