[plt-scheme] custodian - how to exit program when memory limit is exceeded

From: Vladimir Konrad (vladimir at ok2home.net)
Date: Sat Nov 15 10:59:50 EST 2008

> > The following (test) code does not do it:

> > #lang scheme
> > 
> > (custodian-limit-memory (current-custodian) 1)
> > (define x '(1 2 3 4 5 6 7))
> > (write "got here")(newline)
> 
> If you add 
> 
>  (collect-garbage)
> 
> before the last line, then it will exit.
> 
> Memory limits are checked only after a GC --- though in useful
> applications it's an automatic GC that detects the excessive memory
> use, instead of an explicit call to `collect-garbage'.

Thank you, it makes sense...

The above code was a mock-up to see if it works, and with your addition
it does...

Vlad


Posted on the users mailing list.