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: Alexander Fuchs <alexander.fuchs@u...>
Subject: Limiting Memory Usage
Hi,

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, so I added a
C-wrapper to use setrlimit with RLIMIT_AS. I guess that works only with
Linux, which is not nice but better than nothing.

Still, when the memory limit is reached the program just terminates with
"Fatal error: out of memory." resp "Out of memory". I couldn't figure
out if it is possible to catch any of those errors/exceptions, and do
some cleanup before terminating the program.

Does perhaps someone know how to provide this functionality in a more
satisfactory way?

Thanks,
	Alexander