From: Jeff Ward Date: 2002-05-10T09:38:13+09:00 Subject: Re: rb_unload() ? Another question along the same lines.... how would I uninitialize ruby? ruby_run calls ruby_stop and ruby_finalize, neither of which I can call because they call exit. I would like to make sure my program is nice and clean before shutting down. -Jeff Sean Chittenden wrote: >>I'm experimenting with using ruby as embedded scripting language, >>but I've run across a problem. I don't want things to stay resident >>after I'm finished with a file. Is there something like rb_unload >>or rb_flush that won't uninitialize ruby but will remove all defined >>classes, functions, and variables from memory? Even better if >>there's a way to keep constants resident. >> > >Please see mod_ruby and the way that it handles this with garbage >collection. There is no way to do this from the script side as far as >I can tell. You can't unload shared objects yet. knu and I had an >interesting discussion about that on IRC and I was going to play >around with trying to integrate how apr handles this. Under >APR/Apache the memory never gets freed for shared objects, instead the >pointer to the shared object resource gets moved to a new location >where the memory exists. I believe that it is possible to unload a >DSO under FreeBSD (maybe linux), however there is no cross platform >way of accomplishing this. > >hth -sc >