From: "Mauricio Fernández" Date: 2003-04-09T08:10:36+09:00 Subject: Re: [embedding] keeping track of non-exported global variables On Wed, Apr 09, 2003 at 07:56:43AM +0900, Simon Strandgaard wrote: > On Wed, 09 Apr 2003 02:53:13 +0900, Mauricio Fern�ndez wrote: > > Here's my guess: suppose you don't do rb_gc_unregister_address. > > Then, Ruby keeps a pointer to the VALUE, even though you object is dead. > > Yes, dangling pointers is dangerous, because they ofthen result in > segfaults and those can be boring to debug :-) But segfault is the best that could happen! Really! I love when programs segfault, it's so much easier to trace where things went wrong. Now, if it just started to behave strangely... > Thus proper cleanup is important! > > > > Objects::~Objects() { > rb_gc_unregister_address(&objects); > } > > Unregistering all objects: Is this dtor sufficent ??? > > Should I manualy erase each element first ??? > or is this unnecessary? If I got it right, not. The GC won't mark them, and they will be swept away. -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com ...Deep Hack Mode -- that mysterious and frightening state of consciousness where Mortal Users fear to tread. -- Matt Welsh