[plt-scheme] FW: plt-scheme virtual machine has run out of memory, linux
Hello,
if I understand your code correctly, you call scheme_main_setup once but
make calls to the Scheme runtime later, after scheme_main_setup has
returned. This is at least dangerous and from my experience it is also
very likely to fail.
The documentation states that, among other things, scheme_main_setup
determines stack bounds for use by the garbage collector. At least one
of the reasons why it is a bad idea to call any Scheme API function
after scheme_main_setup has returned is that it may easily happen that
your current call frame lies somewhere outside the limits previously
established by scheme_main_setup which is likely to cause memory
corruption and of course once that has happened all hell may break loose
whenever your computer feels like it ;-)
Maybe you can achieve what you want by calling scheme_set_stack_base,
scheme_basic_env and other building blocks of scheme_main_setup directly.
But since all Scheme API calls usually have to be performed on the same
thread and within a certain range of stack frames anyway, I would simply
spawn a dedicated Scheme worker thread and run an endless evaluation
loop inside the callback of scheme_main_setup on that thread.
Ciao,
Thomas
--
When C++ is your hammer, every problem looks like your thumb.