Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
GC hangs application
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Goswin von Brederlow <goswin-v-b@w...>
Subject: Re: [Caml-list] GC hangs application
Paul Steckler <> writes:

> I have an OCaml application that does a lot of string manipulations, generating a
> lot of garbage.  After running awhile, it seems not to make any progress.  The exact
> point where it hangs varies.  The strings aren't very large, but there a lot of them.
> By increasing the size of the minor heap, the application runs much longer.
> And if I turn on Gc.verbose, I see output from the garbage collector just before
> the app hangs.  I mean, there's a print diagnostic in my code on one line, I see
> the Gc output, and the print diagnostic on the next line of my code never appears.
> The problem occurs whether I compile to byte-code or native (Linux x64) code.
> At first, I thought  the hanging problem was due to network code blocking.  But I rewrote
> that to be multithreaded -- no difference.  I changed some other code to use Buffers
> instead of strings, and by generating less garbage, the code went farther.
> Are there known issues with the OCaml gc?  I'm using OCaml 3.11 on Fedora 12.
> -- Paul

Since ocaml doesn't do concurrent multithreading you can still block the
app with one thread blocking. If you have a blocking function you need
to enter/leave_blocking_section() around it. The stubs
do that already but if you have your own stubs they might need that too.

What does strace say?