[plt-scheme] custodian - how to exit program when memory limit is exceeded
> > 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