caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Brian Campbell <bacam@z273.org.uk>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Fatal error: out of memory
Date: Wed, 06 Jun 2012 22:30:02 +0100	[thread overview]
Message-ID: <4FCFCBDA.6010807@z273.org.uk> (raw)
In-Reply-To: <CALhoTJMMa7pxcre0nqNU-q8dgyGQCrZ6Ebx19WSP1XCXBtGzWw@mail.gmail.com>

Hi,

On 05/06/12 01:32, Jianzhou Zhao wrote:
> Hi List,
>
> My program reports "Fatal error: out of memory" as a heisenbug on
> 64-bit machine. When I debugged my code or wanted to print any
> messages from the code, the error did not appear. Also, on 32-bit
> machine, the program has no "out of memory" problem. I found the
> message is from "asmrun/memory.c". Does anyone know any clue or hint
> to resolve the issue?

There's at least one optimisation in the compiler that can affect the 
memory profile of ocaml programs.  If memory serves, "let x = e1 in e2" 
can become "e2[e1]" where e1 is pure and x appears once, and I think 
these are sometimes generated for pattern matching where e1 is a 
projection.  This means that the value projected out of might be held 
for longer than the unoptimised version, increasing the memory usage.

I did have a (rather pathological) example of this where the debug 
version worked but the optimised one ran out of memory, but it was in a 
large application and I was unable to reproduce it later on.  There have 
been some related changes to the optimisation code in the meantime, so 
you might benefit from trying the beta version that was just announced. 
  If nothing else, it applies those optimisations when compiling debug 
versions too, so you might be able to see the failure during debugging.



  parent reply	other threads:[~2012-06-06 21:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05  0:32 Jianzhou Zhao
2012-06-05  1:32 ` [Caml-list] " Jeffrey Scofield
2012-06-06 21:30 ` Brian Campbell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-11-05 11:56 Sarah DJEBALI
2005-11-05 12:07 ` [Caml-list] " Sven Luther
2005-11-05 17:09   ` Sven Luther
2005-11-10 14:51 ` Damien Doligez

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=4FCFCBDA.6010807@z273.org.uk \
    --to=bacam@z273.org.uk \
    --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).