Is an embedded ruby interpreter safe to unload


#1

Hello ruby-talk,

when i use ruby embedded in a program where i call “ruby_init”, do a
few ruby magics and then call “ruby_finalize”.

Will this free all used memory?


#2

On 10 mar, 20:51, Lothar S. removed_email_address@domain.invalid
wrote:

Hello ruby-talk,

when i use ruby embedded in a program where i call “ruby_init”, do a
few ruby magics and then call “ruby_finalize”.

Will this free all used memory?

You want to call ruby_cleanup(0); instead, like ruby_stop() does.
ruby_finalize() does not deal with threads.


#3

Hello gga,

Will this free all used memory?

g> You want to call ruby_cleanup(0); instead, like ruby_stop() does.
g> ruby_finalize() does not deal with threads.

Thanks,

i looked at the source and realize that there is no way to cleanly
shutdown the ruby interpreter. This will just call all registered exit
functions.

Very very bad because this means it’s very hard to use memory leak
checking
tools for extensions or much worse for systems that use ruby as an
embedded
interpreter.