[JDEV] Leak, bug -- fixed -- maybe

Glenn MacGregor gtm at oracom.com
Mon Apr 1 17:25:06 CST 2002


Ok,

So the problem was not a leak, it was a design flaw in the system.  What was
happening was memory was getting allocated by the session pool for every
message, which only gets freed when the user logs out, session closes.

jsm/session.c at _js_session_from you will see at line 252 or so that we
create a new jid struct using jid_full with the session->id meaning that the
new jid is allocated from the session pool, not good.  So every message we
allocate from the session pool, when we should be allocating from the packet
pool, which gets freed when the packet is handled.

So we have created a new jid_full function, jid_full_from_pool(pool, jid).
Also we used the new jid_cmpx instead of using jid_cmp which relieves us
from having to create a new jid.  I have a patch for the 1.4.2 server.
Don't know if it is worth getting into the base but that code hasn't really
changed much so if the plan was to reuse some of the jsm and jabberd stuff
in the 1.5 it maybe good to get it in.

I have only done initial testing but it looks good so far.

I will not attach the patch due to size, but if someone can tell me where I
can put I will.

    Thanks for all your help


            Glenn




More information about the JDev mailing list