I've had the same question, i've solved it like this:
type
FooObj = object
sss: string
iii: int
Foo = ref FooObj
proc `=destroy`(comp: var FooObj) =
echo "DESTRUCT: ", comp.sss
proc testproc(sss: string) =
var foo = Foo(sss: sss)
testproc("first")
testproc("second")
GC_fullCollect() # to force collection with default gc not needed arc/orc
in this example
Run
