caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sylvain Le Gall <sylvain@le-gall.net>
To: caml-list@inria.fr
Subject: Re: Being aware of memory overuse
Date: Sat, 6 Feb 2010 13:34:40 +0000 (UTC)	[thread overview]
Message-ID: <slrnhmqrvh.ckm.sylvain@gallu.homelinux.org> (raw)
In-Reply-To: <FCD24B5C-3E72-489B-8F09-A3F3A5BE0C41@mlstate.com>

On 05-02-2010, David Rajchenbach-Teller <David.Teller@mlstate.com> wrote:
>        Dear list,
>  I'm writing some code that needs to be able to cope nicely with
>  memory exhaustion. That is, it should be able to detect at some point
>  if it is getting close to exhausting memory, and take the necessary
>  course of action (e.g. bailing out nicely). I'm wondering what's the
>  best way of doing this. I've been thinking about installing a
>  [Gc.alarm] and checking [Gc.free_words], [Gc.free_blocks],
>  [Gc.largest_free] just after each major cycle, but I'm wondering if
>  it's the best technique.
>
> Any suggestion?
>

I worked on this subject, for a tool that need to use as much memory as
possible. I started by trying to use Gc module. I ended by reading
/proc/meminfo and getting/checking data from there. It is fast, simple
and very precise. In particular, it can take into account other
processes that take memory.

Regards,
Sylvain Le Gall


  reply	other threads:[~2010-02-06 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-05 10:34 David Rajchenbach-Teller
2010-02-06 13:34 ` Sylvain Le Gall [this message]
2010-02-10  8:45   ` [Caml-list] " Goswin von Brederlow
2010-02-10 13:43     ` Dario Teixeira
2010-02-10 17:47       ` Sylvain Le Gall
2010-02-10 21:31       ` [Caml-list] " 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=slrnhmqrvh.ckm.sylvain@gallu.homelinux.org \
    --to=sylvain@le-gall.net \
    --cc=caml-list@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;
as well as URLs for NNTP newsgroup(s).