[jdev] sm memory leaks

Robert Norris rob at cataclysm.cx
Tue Mar 2 15:43:17 CST 2004

On Tue, Mar 02, 2004 at 01:08:29PM -0500, Bob Phan wrote:
> I've been trying to get j2 to scale.  So far, I've been able to get
> about 8000 connections to the server before sm consumes about 3gigs of
> memory and then locks up the system.  I'm fairly sure that 8000
> connections doesn't _require_ 3gigs of ram, so there must be some kind
> of memory leak in the sm.
> I'm curious if this is a known issue.  Also, I'd like to be able to
> help track down and fix whatever memory leaks may exist in the sm.
> If anyone could give me any help as to where to begin or how to
> go about this, it would help out a lot.  I don't think blindly
> diving into the sm code would be the best approach for this, so if
> you know any sections of the code that may be linked to the sm
> leakage, I'll start looking around there and try and patch up the
> leaks.

j2 is currently pretty lousy when it comes to memory management. It
generally assumes that it can get as much memory as it wants. Certain
things (eg the JID cache) are never freed or cleaned up, and can grow

A real memory management plan is being developed for the next round of
server work, which should alleviate this.

As for dicovering real memory leaks, I suggest checking out
http://valgrind.kde.org/ . I usually run it as:

  valgrind --skin=memcheck --num-callers=8 --leak-check=yes --show-reachable=yes

Run the j2 pieces inside it, do your tests, and take a look at the
valgrind logs when you're done. It will identify leaked memory.


Robert Norris                                       GPG: 1024D/FC18E6C2
Email+Jabber: rob at cataclysm.cx                Web: http://cataclysm.cx/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.jabber.org/pipermail/jdev/attachments/20040303/47b2ff55/attachment-0002.pgp>

More information about the JDev mailing list