. It seems like empty array or string with the same content share the same references. That's why I got lot of references for the empty array. So I put something like ({ "ThisiSaRandDomString232323239084 "}) in every arrays of the objects and they are not referenced anymore.
Ok, that explains it. (But there's no use avoiding the empty string and array just becaused they're referenced from a lot of places.)
Is it enough to set those variables to 0 ?
Depends on what you want to accomplish. If you want to avoid garbage that's left around until the next gc then you only need to zero variables if their values directly or indirectly refers to the object they're in. Normal acyclic structures are freed as soon as possible through reference counting.
. _refs always report lot of references but _locate_references doesn't find them. For example I have lot of things like this for strings:
_locate_references doesn't work well for strings. It uses the gc to go through the memory and the gc doesn't care about strings since they can't reference anything else and therefore can't be part of cycles.
. When I call destruct(), destroy() is sometimes not called after some time or after the user login again or if I reload the module.
I assume there's a "not" too much in that sentence. Seems like destroy is called by the gc or as a result of that the object runs out of references. Are you absolutely sure that you call destruct on the right object? I often put in some debug code like this to make sure I can tell objects apart:
static int obj_counter; class MyObject { static int id = ++obj_counter; string _sprintf (int flag) {return flag == 'O' && "MyObject(" + id + ")";} }
/ Martin Stjernholm, Roxen IS
Previous text:
2003-06-10 12:05: Subject: Re: Debugging memory problems
On Thu, 5 Jun 2003, Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
Hi,
Here are some more notes I have regarding this problem:
. It seems like empty array or string with the same content share the same references. That's why I got lot of references for the empty array. So I put something like ({ "ThisiSaRandDomString232323239084 "}) in every arrays of the objects and they are not referenced anymore. Is it enough to set those variables to 0 ? . _refs always report lot of references but _locate_references doesn't find them. For example I have lot of things like this for strings:
variable searchstring ("") is referenced 1044 times **Looking for references to 0x83773ec: **Done looking for references to 0x83773ec. variable defaultsentfolder ("") is referenced 1044 times **Looking for references to 0x83773ec: **Done looking for references to 0x83773ec.
Is it normal ?
. When I call destruct(), destroy() is sometimes not called after some time or after the user login again or if I reload the module.
/ David Gourdelier
Please ignore that; I missed the stop function.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-06-05 17:20: Subject: Re: Debugging memory problems
There's a reference back through sess->imapclient->session.
/ Martin Stjernholm, Roxen IS
-- David Gourdelier
/ Brevbäraren