Garbage collection with glib?

mail.gnome.org/archives/gtk-devel-list/2... is old but still relevant.

mail.gnome.org/archives/gtk-devel-list/2... is old but still relevant. Learning how language bindings work (proxy objects, toggle references) would probably be helpful in thinking this through. Update: oh, from hearing Boehm GC I was thinking you were trying to replace g_malloc etc.With GC, as in that old post.

If you're doing a language binding (not GC'ing C/C++) then yes that's very achievable. A good pretty manageable example to read over would be the gjs (SpiderMonkey JavaScript) codebase. The basic idea is that you're going to have a proxy object that "holds" a GObject and often has the only reference to the GObject.

But, the one complexity is toggle references: mail.gnome.org/archives/gtk-devel-list/2... You have to store the proxy object on the GObject so you can get it back (say someone does widget. Get_parent(), then you need to return the same object that was previously set as the parent, by retrieving it from the C GObject). You also have to be able to go from the proxy object to the C object obviously.

2001 is practically prehistory gobject-wise. – David Given Jun 5 at 10:40 Other than the addition of toggle refs I'm not sure the basic picture has changed since then. The big change was GtkObject to GObject in 2.0.0 – Havoc P Jun 5 at 17:12 I think the short answer here is that GC won't really work in C/C++ because you won't be able to run finalizers.

But you could use a C++ binding with smart pointers. Years ago I prototyped a light C++ binding called Inti that was just smart pointers (just a header file almost) rather than a full wrapper. – Havoc P Jun 5 at 17:14 oh, I missed you're binding a language.

In that case you are fine. Just copy any of the existing language bindings. – Havoc P Jun 5 at 17:17 Oh, well.

I was rather hoping to avoid all the reference counting nonsense by simply using the garbage collector to collect everything and so make the problem go away, but it sounds like there's just too many fiddly edge conditions for it to work reliably. Looks like I'll just have to use proxies.(After spending way too many years fighting a reference counted operating system I loathe it with a passion --- it's a pale, fiddly and hard-to-work imitation of real garbage collection...) – David Given Jun 5 at 17:49.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions