From: "Richard P. Groenewegen" Date: 2004-10-25T06:51:21+09:00 Subject: "add" function in swig and the ruby GC? Hi, I'm trying to write an add-function in C++ with swig, but I think that ruby does not Garbage collect my objects. Example: class Thingy { public: Thingy() { } ~Thingy() { cout << "Thingy is destructed."; } Thingy *add(const Thingy *other) const { Thingy *result = new Thingy(); // ... return result; } } Using GC.start I can check that ruby does not destruct Thingies made with "add". So, what is the correct way to do this? I could return a Thingy instead of a Thingy*, but is this the preferred(TM) way? best regards, Richard