From: Jim Weirich Date: 2002-03-08T14:42:29+09:00 Subject: Re: Talking Trash About Ruby >>>>> "Lyle" == Lyle Johnson writes: Lyle> So I guess I have a few questions at this point: Lyle> 1. Am I correct that during the garbage collector's "mark" Lyle> phase, only those objects that are truly reachable from some Lyle> other object should be having their "mark" function called? I don't think so. IIRC, Ruby uses a conservative GC algorithm and may mark some things reachable that are not actually still live. Lyle> This is a big problem because the C++ object that this Data Lyle> object refers to has in fact been destroyed by this point, Lyle> and so the Ruby Data object has a "dangling" pointer. Perhaps when you destroy your C++ object, you should clobber the dangling pointer to that object (i.e. set it to NULL). Then, if the mark routine is called at a later time, you know that the C++ object is already destroyed. I've been playing around with the canvas object in FXRuby, and occasionally I will get a core dump. Do you suppose this is a manifestation of the problem you describe? -- -- Jim Weirich jweirich@one.net http://w3.one.net/~jweirich --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)