Re: Garbage collection in Gtk



You cannot do mark-and-sweep gc with languages like C (and C++).  You
would have restrict yourself to some subset of the language.

The problem is that you need to find all live pointers.  Including those
printed with  fprintf (foo, "%p", ptr);  and emailed to Australia.

You also have to find those written in binary format to a file.

You also have to find those pointers what a thread is in the middle
of swapping byte-by-byte.

Then there is shared memory, more an OS than a C concept, though -- you
can have pointers there if you want to.  And you could use ptrace to
peek at a process' memory.

Bottom line: garbage collection in full C is a pipe dream.

I.e., stick to ref-count stuff.

Morten



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