Version française
Home     About     Download     Resources     Contact us    
Browse thread
Limiting Memory Usage
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Chris King <colanderman@g...>
Subject: Re: [Caml-list] Limiting Memory Usage
On 7/13/06, Alexander Fuchs <alexander.fuchs@uni-koblenz.de> wrote:
> I would like to:
> - limit the max. memory usage of an ocaml program
> - and do some cleanup and then terminate then program, when this limit
> is reached.
>
> I couldn't see how to do that with the standard libraries,

Did you look at Gc?  It's not a hard limit but periodically checking
(quick_stat ()).heap_words will give you a rough estimate of how much
memory your program is using (not exact since it doesn't count
code/stack/etc.).

- Chris King