Hello,
The problem is that timeout should not reference the object anymore.
You mean the call variable? Yes, you have to zero it yourself; remove_call_out doesn't do that for you.
Ok thank you.
If you can't rely on the gc then you have to make sure that you break up all reference cycles, just like when you assign zero to the call variable. A robust way to do that is to destruct the object explicitly (but that can bring its own problems if there are multiple threads that access it etc). Roxen destructs the RequestID objects explicitly for this reason.
Ok. I have another problem with cycle reference. Given this code:
class session { object imapclient; string a = "toto"; }
class imapclient { object session; void create() { } void start(object _session) { session = _session; } void stop() { session = 0; } };
int main() { object sess = session(); sess->imapclient = imapclient(); sess->imapclient->start(sess); sess->imapclient->stop(); _locate_references(sess->imapclient); write("a=%s\n", sess->a); return -1; }
I get:
**Looking for references to 0x83a1e40: ***One ref found in an object. -> from object 0x83a1ea0 offset -445904 **In variable imapclient **In storage for inherit 0 **Location: 0x83a1ea0 Type: object Refs: 1 **Program id: 65621 **Describing program of object: **Program id: 65621, flags: f **Location: /home/david/scripts/memory.pike:52 **There is no parent (any longer?) ******************* ----------end------------ **Done looking for references to 0x83a1e40.
The problem is that I can't destruct(sess) because I need it after in main().