R
Richard P. Groenewegen
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
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