On 01/01/2012 05:01 PM, syshen wrote:

> So in this case I think the memory usage of my program should be the same
> like before calling minisat_save_proof , because the returned data should be
> collected by the garbage collector when exiting the method A to the main loop.
> But from the unix "top" command, I find that these huge return data seems to
> remain in memory and consume all my memory step by step.

There are several possible explanations:

1- Your program is actually keeping a reference to this big piece of
data, so it cannot be reclaimed.

2- You're falling into PR#5389, http://caml.inria.fr/mantis/view.php?id=5389
whereas OCaml's compactor can fail to return some memory to the malloc()
subsystem.

3- The malloc() implementation on your system elected not to / was
unable to return memory to the OS, hence the numbers reported by
"top" stay constant.

What happens if you run your test in an infinite loop?  Does memory
usage (as reported by "top") stays constant or increases as a function
of time?  Only the latter case is really problematic.

- Xavier Leroy

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to