From: Damien Doligez <damien.doligez@inria.fr>
To: caml-list caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] More re GC hanging
Date: Wed, 1 Sep 2010 17:24:21 +0200 [thread overview]
Message-ID: <A07AE00F-9059-498A-87E9-6B9E2F25B7CC@inria.fr> (raw)
In-Reply-To: <AANLkTi=THbdWiXf=m8puWou2swFiDXLTHP2W=ta-0_TB@mail.gmail.com>
On 2010-08-15, at 12:45, Adrien wrote:
> First, remove all non-tail-rec functions: no more List.map, @ or
> List.concat. All lists were pretty short (definitely less than 1000
> elements) but maybe the amount of calls generated garbage or something
> like that: I couldn't get much infos about the problem so I tried what
> I could think of and being tail-rec couldn't be a bad thing anyway.
> The idea was to create less values since I first suspected a memory
> fragmentation issue (iirc I had thousands of fragments), so I also
> memoized some functions.
That has nothing to do with the GC getting huge counts. Also, if you
have fragmentation problems, you can try changing the allocation
policy with this statement:
Gc.set {(Gc.get ()) with Gc.allocation_policy = 1};;
I'm still waiting for feedback on that alternate allocation policy :-)
> Then, as Basile mentionned, call something like Gc.compact ()
> regularly. The overhead is actually pretty small, especially if ran
> regularly.
That's good for tracking down problems, but I wouldn't recommend it
for production code.
> Finally, C bindings. I created a few while not having access to the
> internet and they are quite dirty. I highly doubt they play perfectly
> well with the garbage collector: they seem ok but probably aren't
> perfect. That's definitely something to check, even if the bindings
> were written by someone else because working nicely with the GC can be
> quite hard.
>
> Now, the problem seems to be gone but I can't say for sure. One really
> annoying thing was that adding a line like 'print_endline "pouet";'
> would make the out-of-memory problem go away! Same when getting stats
> from the GC.
That almost certainly indicates a problem with your C bindings: some
pointer gets garbled and the GC may or may not stumble upon it.
-- Damien
next prev parent reply other threads:[~2010-09-01 15:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-15 5:57 Paul Steckler
2010-08-15 7:03 ` [Caml-list] " Basile Starynkevitch
2010-08-15 8:34 ` Paul Steckler
2010-08-15 8:40 ` Paul Steckler
2010-08-15 9:16 ` Basile Starynkevitch
[not found] ` <AANLkTi=-8ZcxSy08fsh8wkTvscGLYzBsqN07OmOi5o6d@mail.gmail.com>
2010-08-15 9:55 ` Fwd: " Paul Steckler
2010-08-15 10:41 ` Fwd: " Sylvain Le Gall
2010-08-15 11:32 ` [Caml-list] " Vincent Hanquez
2010-08-15 10:45 ` [Caml-list] " Adrien
2010-08-15 11:17 ` David Allsopp
2010-08-15 12:12 ` Basile Starynkevitch
2010-09-01 15:24 ` Damien Doligez [this message]
2010-09-01 16:44 ` Adrien
2010-08-15 10:19 ` rixed
2010-08-20 15:21 ` Richard Jones
2010-08-20 23:30 ` Eray Ozkural
2010-08-22 13:02 ` Adrien
2010-08-25 15:17 ` Goswin von Brederlow
2010-08-18 12:22 ` Goswin von Brederlow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A07AE00F-9059-498A-87E9-6B9E2F25B7CC@inria.fr \
--to=damien.doligez@inria.fr \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox