Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] Fatal error: out of memory
@ 2012-06-05  0:32 Jianzhou Zhao
  2012-06-05  1:32 ` [Caml-list] " Jeffrey Scofield
  2012-06-06 21:30 ` [Caml-list] " Brian Campbell
  0 siblings, 2 replies; 3+ messages in thread
From: Jianzhou Zhao @ 2012-06-05  0:32 UTC (permalink / raw)
  To: caml-list

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?

Thanks!
--
Jianzhou

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

* [Caml-list] Re: Fatal error: out of memory
  2012-06-05  0:32 [Caml-list] Fatal error: out of memory Jianzhou Zhao
@ 2012-06-05  1:32 ` Jeffrey Scofield
  2012-06-06 21:30 ` [Caml-list] " Brian Campbell
  1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey Scofield @ 2012-06-05  1:32 UTC (permalink / raw)
  To: caml-list

Jianzhou Zhao <jianzhou@seas.upenn.edu> writes:

Greetings,

> 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?

Is your program pure OCaml?  This could make a big difference in the
troubleshooting.  Are you using any particular external libraries?

You don't give much to go on, otherwise.  I haven't seen this error in
OCaml but in my experience this kind of error is more often caused
by corruption in memory management than by actually running out
of memory.

With nothing else to go on, my guess would be an error in the OCaml/C
interface to an external library.  Perhaps the code is written assuming
32 bit pointers, or similar.

Jeffrey


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

* Re: [Caml-list] Fatal error: out of memory
  2012-06-05  0:32 [Caml-list] Fatal error: out of memory Jianzhou Zhao
  2012-06-05  1:32 ` [Caml-list] " Jeffrey Scofield
@ 2012-06-06 21:30 ` Brian Campbell
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Campbell @ 2012-06-06 21:30 UTC (permalink / raw)
  To: caml-list

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.



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

end of thread, other threads:[~2012-06-06 21:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-05  0:32 [Caml-list] Fatal error: out of memory Jianzhou Zhao
2012-06-05  1:32 ` [Caml-list] " Jeffrey Scofield
2012-06-06 21:30 ` [Caml-list] " Brian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox