From: Matthew Metnetsky Date: 2008-02-21T02:04:52+09:00 Subject: embedding ruby | marking and sweeping wrapped structs --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable All, I've managed to get ruby embedded and executing everything the way I need f= or the most part without much problem. But I am currently hitting a wall and merely trying different methods isn't getting me anywhere. Each script that= I load needs to be run in as fresh a state as possible, and once it's done I need to make sure everything is released before loading the next script.=20 The ruby file is being loaded like so: rb_load_protect("test.rb", 0, &status); On success I look for the class I'm trying to instantiate and grab a copy of it and then register it. VALUE obj =3D rb_class_new_instance(...) rb_gc_register_address(&obj); After I've called the appropriate methods, I unregister it and tell the GC = to run: rb_gc_unregister_address(&obj); At this point I would like to force "obj" to be marked, and freed. But I am not sure what to do as rb_gc() does mark it, but it never gets freed. It's important to note that `TYPE(obj) =3D=3D T_DATA`, and I cannot get it = to be called until ruby_finalize() is issued at the VERY end of the program.=20 As such, is there a way to force the sweeping of this object now that I know it is done? In fact I would like to loop back to rb_load_protect(..) to knowing that as much of the data as possible has been removed, but how? Any and all help will be greatly appreciated! Thanks in advance, ~ Matthew --HlL+5n6rz5pIUxbD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHvFt5LrcoBjlTBf0RAguMAJ40M075rURw6v60Fe+7mCr58W0+fwCfYu9K 3+YIe9bQmRvJAWXC99+HdiQ= =O1uM -----END PGP SIGNATURE----- --HlL+5n6rz5pIUxbD--