Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help requested - Another Memory leak #18

Closed
CyrilPeponnet opened this issue Sep 14, 2014 · 2 comments
Closed

Help requested - Another Memory leak #18

CyrilPeponnet opened this issue Sep 14, 2014 · 2 comments

Comments

@CyrilPeponnet
Copy link

I spotted another potential memory leak here:

dispatcher.py:

    def SendAndCallForResponse(self, stanza, func, args={}):
        """ Put stanza on the wire and call back when recipient replies.
            Additional callback arguments can be specified in args. """
        self._expected[self.send(stanza)]=(func,args)

Actually and contrary to SendAndWaitForResponse, the self._expected dict remains wired to all stanza/cb receveid as you ca see here:

graph dot

We clearly see that self._expected contains all ID and what ever they are linked too.

I try to figure out how to fix this, I'm asking for help about that.

Thanks

@snakeru
Copy link
Collaborator

snakeru commented Sep 14, 2014

I can remember fighting memory leaks myself.

I'm not very sure if that was xmpppy, but it's very likely. The solution
was to break these dependency loops in del to ease work of GC.

Also, I believe, another solution happened to be to migrate to newer
cpython interpreter, which handled dependency loops. That was early 2007,
so most likely that was CPython 2.6.
Am 14.09.2014 02:00 schrieb "Cyril Peponnet" notifications@github.com:

I spotted another potential memory leak here:

dispatcher.py:

def SendAndCallForResponse(self, stanza, func, args={}):
    """ Put stanza on the wire and call back when recipient replies.            Additional callback arguments can be specified in args. """
    self._expected[self.send(stanza)]=(func,args)

Actually and contrary to SendAndWaitForResponse, the self._expected dict
remains wired to all stanza/cb receveid as you ca see here:

[image: graph dot]
https://cloud.githubusercontent.com/assets/2277387/4262430/f3d42db0-3ba1-11e4-9325-5c6233f0b67e.png

We clearly see that self._expected contains all ID and what ever they are
linked too.

I try to figure out how to fix this, I'm asking for help about that.

Thanks


Reply to this email directly or view it on GitHub
#18.

@CyrilPeponnet
Copy link
Author

Actually cleaning the _expected dict seems to do the trick.

            if type(session._expected[ID])==type(()):
                cb,args=session._expected[ID]
                del session._expected[ID]

Not sure why only the cb case the _expected dict was not cleared but it seems to fix the memory ballooning issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants