> "gtkmm" which is a C++ wrapper and I'm quite sure it uses C++ destructors.
That is a fine hint. I don't know much about gtkmm, so I am not sure if they really use C++ destructors or just plain gtk internal ref counting as C does. Will ask Mr E.Bassi at gtk forum. Found comment of mratsim: [https://forum.nim-lang.org/t/4797#30036](https://forum.nim-lang.org/t/4797#30036) > Shouldn't context stay a ref object? It's not a type that you can trivially > copy (i.e. it's a resource like memory, a socket, a file handle, not an > integer or string). My impression was that Destructors works best for stack objects. But I can imagine that with Destructors one theoretically can write a custom memory management system which supports some form of GC_ref(), then it may work for gtk. > finalizers are attached to the "new" call which sucks; Interesting, other people said that in the past too. I think finalizers attached to the types would be fine for gtk.