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
[Caml-list] Str memory leak in 3.06?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-04-24 (23:27)
From: Chris Hecker <checker@d...>
Subject: Re: [Caml-list] Str memory leak in 3.06?

>No, there is no need for explicit deallocation of regexps.  Actually,
>there is no leak either: if you put a call to Gc.major() in the loop,
>memory usage remains constant.

Ah, I thought a Gc.compact () did a major collection (the docs say it 
does), and that didn't help.  Maybe I didn't wait long enough?  I just put 
the Gc.major () in there and waited a long time and it seemed to settle out 
eventually, but only after it had allocated 800MB and had paged the rest of 
the world out, which seems big.  Shouldn't the major collection find that 
there is only one live regexp and collect all of the others, and keep the 
heap way smaller than 800MB?

>What happens is that the speed of the (incremental) major collector
>isn't appropriately adjusted, so it runs too slowly and lets "floating
>garbage" accumulate.  This is a common problem with Caml objects that
>are just handle on resources allocated outside the Caml heap: precise
>determination of the space consumption of the latter is generally
>impossible, causing the incremental major GC to run often too slowly,
>sometimes too fast...

Ah, is there something Str could do to avoid this, like setting the 
mysterious alloc_custom parms differently?  Also, how could I have figured 
this out myself and not bothered the list?


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: