Skip to content

RecipientFilter instances are never deleted #124

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

Closed
jsza opened this issue May 10, 2016 · 5 comments
Closed

RecipientFilter instances are never deleted #124

jsza opened this issue May 10, 2016 · 5 comments
Labels

Comments

@jsza
Copy link
Contributor

jsza commented May 10, 2016

I've managed to reproduce a memory leak on TF2 Linux (SP version 327) with:

from listeners import OnTick
from messages import KeyHintText
from filters.players import PlayerIter

text = 'a' * 240

@OnTick
def on_tick():
    for player in PlayerIter():
        for x in range(40):
            KeyHintText(text).send(player.index)

The flood of data causes the game client to freeze, but running the plugin causes a steady increase of ~1MB memory usage every few seconds.

I've tested with SayText2 and HintText messages with the same result.

@Ayuto Ayuto added the bug label May 10, 2016
@Ayuto
Copy link
Member

Ayuto commented May 10, 2016

This memory leak is caused by the RecipientFilter instances, which are never deleted. This is caused by the HeldType definition:

class_<MRecipientFilter, MRecipientFilter*, bases<IRecipientFilter>, boost::noncopyable >("_RecipientFilter")

Funny thing:
If I correct the HeldType, the server crashes as soon as the RecipientFilter instance gets deleted. Delaying the delete doesn't help. If the instance gets deleted e.g. 5 seconds after the user message has been sent, the server crashes exactly after the 5 seconds passed.

I will need more time to figure out what's happening here...

Edit: The crash only occurs on Windows.

@Ayuto
Copy link
Member

Ayuto commented May 11, 2016

Finally, I found the reason for the crashes! It's the memory debugging include here:
https://github.com/alliedmodders/hl2sdk/blob/css/public/tier1/utlmemory.h#L22

This affects us, because we are using CUtlVector for our MRecipientFilter class and the CUtlVector class utilizes CUtlMemory. I will now try to find out why the memory debugging causes crashes.

Ayuto added a commit that referenced this issue May 19, 2016
Ayuto added a commit that referenced this issue May 19, 2016
It doesn't compile with Blade and CS:GO...
@jsza
Copy link
Contributor Author

jsza commented Aug 14, 2016

Thank you for looking into this Ayuto!

Has there been any more progress on getting the fix to compile?

@Ayuto
Copy link
Member

Ayuto commented Aug 14, 2016

No, sorry. IRC, I ran into other issues, when I fixed the errors.

@jordanbriere
Copy link
Contributor

While this doesn't fix the real issue, 82393fb prevent leaking from the effects and messages package.

@jordanbriere jordanbriere changed the title Memory leak in usermessages? RecipientFilter instances are never deleted Oct 25, 2016
jordanbriere pushed a commit that referenced this issue Oct 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants