Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] debugging memory leaks

87 views
Skip to first unread message

Chris Waterson

unread,
Nov 12, 2007, 12:56:46 AM11/12/07
to caml...@yquem.inria.fr
I have a fairly substantial OCaml application that leaks memory.
What tools or techniques do people use to track down memory leaks?
Minimally, is there a way to enumerate the live objects in the heap?

I've tried "valgrind" on a natively-compiled executable, but all the
"real" allocations are hidden in the Caml heap, so it's not very useful.

Any recommendations would be warmly welcomed. Thanks in advance...

chris

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Pierre Etchemaïté

unread,
Nov 12, 2007, 2:54:12 AM11/12/07
to caml...@yquem.inria.fr
Le Sun, 11 Nov 2007 21:56:06 -0800, Chris Waterson <wate...@maubi.net> a écrit :

> I have a fairly substantial OCaml application that leaks memory.
> What tools or techniques do people use to track down memory leaks?
> Minimally, is there a way to enumerate the live objects in the heap?

There's ocaml-memprof, a compiler patch that adds memory profiling
features to ocaml programs;

Latest update of the patch itself, as far as I know:
http://www.pps.jussieu.fr/~smimram/docs/ocaml-3.09.3-memprof.patch

Readme:
http://www.pps.jussieu.fr/~smimram/docs/README.memprof

Chris Waterson

unread,
Nov 12, 2007, 1:08:17 PM11/12/07
to caml...@yquem.inria.fr
On Nov 11, 2007, at 11:53 PM, Pierre Etchemaďté wrote:

> Le Sun, 11 Nov 2007 21:56:06 -0800, Chris Waterson
> <wate...@maubi.net> a écrit :
>
>> I have a fairly substantial OCaml application that leaks memory.
>> What tools or techniques do people use to track down memory leaks?
>> Minimally, is there a way to enumerate the live objects in the heap?
>
> There's ocaml-memprof, a compiler patch that adds memory profiling
> features to ocaml programs;
>
> Latest update of the patch itself, as far as I know:
> http://www.pps.jussieu.fr/~smimram/docs/ocaml-3.09.3-memprof.patch
>
> Readme:
> http://www.pps.jussieu.fr/~smimram/docs/README.memprof

Wow. This is fantastic!

I had to hack the patch a bit since I'm using objects in a handful of
places, but this is exactly what I needed.

Thanks a ton!

chris

Fabrice Le Fessant

unread,
Nov 12, 2007, 3:53:54 PM11/12/07
to Pierre Etchemaïté, caml...@yquem.inria.fr
Interesting, I did a patch in 2004, called ocaml-memprof for
ocaml-3.07,but there is not a single reference/credit to it on this
page... Given the inheritance, the maintainer should be careful to
keep the original author's name.

- Fabrice Le Fesasnt
ASAP Project, INRIA Saclay

Samuel Mimram

unread,
Nov 12, 2007, 6:02:37 PM11/12/07
to Fabrice Le Fessant, caml...@yquem.inria.fr
Hi,

Since I put the patch on my webpage I owe you an apology. If I remember
well, I got the link on IRC while having issues with memory and the only
thing I did was to resolve the conflicts generated by diff. I put it on
the net because it was hard to find and apparently it was useful to
other people. I'm correcting the credits right now.

Regards,

Samuel.

warrensomebody

unread,
Jan 28, 2010, 11:34:25 PM1/28/10
to caml...@yquem.inria.fr

I know this is an old thread, but I have revised the memprof patch to work
with ocaml-3.11.2. Please let me know if there is a maintainer who would
like to look this over and/or distribute it. Otherwise, I'll put it up on
github or google code. Thanks,

Warren

--
Warren Harris
war...@metaweb.com
Metaweb Technologies
http://www.freebase.com - An open database of the world’s information.


Samuel Mimram-2 wrote:
>
> Hi,
>
> Since I put the patch on my webpage I owe you an apology. If I remember
> well, I got the link on IRC while having issues with memory and the only
> thing I did was to resolve the conflicts generated by diff. I put it on
> the net because it was hard to find and apparently it was useful to
> other people. I'm correcting the credits right now.
>
> Regards,
>
> Samuel.
>
>
> Fabrice Le Fessant wrote:
>> Interesting, I did a patch in 2004, called ocaml-memprof for
>> ocaml-3.07,but there is not a single reference/credit to it on this
>> page... Given the inheritance, the maintainer should be careful to
>> keep the original author's name.
>>
>> - Fabrice Le Fesasnt
>> ASAP Project, INRIA Saclay
>>

>> On Nov 12, 2007 8:53 AM, Pierre Etchemaïté <petc...@concept-micro.com>

--
View this message in context: http://old.nabble.com/debugging-memory-leaks-tp13700286p27366754.html
Sent from the Caml Discuss2 mailing list archive at Nabble.com.

Richard Jones

unread,
Feb 2, 2010, 4:00:27 AM2/2/10
to warrensomebody, caml...@yquem.inria.fr
On Thu, Jan 28, 2010 at 08:34:13PM -0800, warrensomebody wrote:
>
> I know this is an old thread, but I have revised the memprof patch to work
> with ocaml-3.11.2. Please let me know if there is a maintainer who would
> like to look this over and/or distribute it. Otherwise, I'll put it up on
> github or google code. Thanks,

I think something like github / google code is a very good idea, then
someone can pick it up at a later date when they need it.

Rich.

--
Richard Jones
Red Hat

Sylvain Le Gall

unread,
Feb 2, 2010, 5:29:35 AM2/2/10
to caml...@inria.fr
On 29-01-2010, warrensomebody <warrens...@gmail.com> wrote:
>
> I know this is an old thread, but I have revised the memprof patch to work
> with ocaml-3.11.2. Please let me know if there is a maintainer who would
> like to look this over and/or distribute it. Otherwise, I'll put it up on
> github or google code. Thanks,
>

You could consider, putting your code on
http://forge.ocamlcore.org

This is probably the place where it will have the best visibility for
other OCaml developers.

Regards
Sylvain Le Gall

0 new messages