Memoryleak in python module?

Bug #518972 reported by Sulan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ADCH++
Fix Released
Undecided
Unassigned

Bug Description

I have been doing some testing with the adchpp python module (for adchppgui). I noticed that after a while the memory usage started rising rapidly. I had about 500 users in the hub and got up to 450mb of memory usage about an hour after start.
I thought it might be someting with my code at first, so tested without handeling any commands, by returning ok as soon as i got a command. This did not help, still had memory increasing.

I used this method to see increasing reference counts: http://www.lshift.net/blog/2008/11/14/tracing-python-memory-leaks
These are 2 examples of the output (removed some stuff that wasn't increasing)

Reference counts by name:
------------------------------
510 users in hub
dict 252297
tuple 162306
Entity 121184
AdcCommand 118484
Bot 3218
------------------------------
514 users in hub
dict 312796
tuple 193050
Entity 151088
AdcCommand 148219
Bot 4058
------------------------------

Revision history for this message
Sulan (sulan80) wrote :

build\release-mingw\swig\python_wrap.cc:1545: warning: dereferencing pointer 're
s' does break strict-aliasing rules

Could these warnings be the cause of the memory leak?
I googled it, and found this:
http://stackoverflow.com/questions/98650/what-is-the-strict-aliasing-rule

Revision history for this message
Sulan (sulan80) wrote :

With this patch my refcounts stay more stable.

Revision history for this message
Sulan (sulan80) wrote :

Opps, that patch also included stuff from bug #519257. There is probably a better way to do this, but i think it shows the problem.

Revision history for this message
Sulan (sulan80) wrote :

This is the reference counts using supplied patch:
http://pastebin.com/m4ccf0b37

Revision history for this message
Jacek Sieka (arnetheduck) wrote :

Thanks for the patch - it is slightly wrong though in that it doesn't decrease the reference count on early function exit-...better use pyhandle instead...

Changed in adchpp:
status: New → Fix Committed
Revision history for this message
poy (poy) wrote :

Fixed in version 2.5.0.

Changed in adchpp:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.