[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ extension and garbage collection



On Wed, 27 Mar 2002, Matthew Flatt wrote:
> > Can I do something in my C++ code to inform the GC about my objects,
> > so that they aren't collected?
...
> But that doesn't solve the problem when you use `new' on structs (if
> any) or arrays of integers.

That's an interesting remark.  I've noticed that new structures seem
to be collected, but new classes don't seem to be collected, even if
they contain the same structure.  For example

  new Tcl_HashTable

gets collected, but

  new Pad_HashTable

doesn't, even though it contains a Tcl_HashTable.

class Pad_HashTable {
 ...
 private:
   Tcl_HashTable table;
}

Why are new structures collected, but not new classes?
>From gdb it appears the same new is used.

Thanks,

Ron
stanonik@cogsci.ucsd.edu