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

zfec.Encoder and zfec.Decoder leak memory on re-initialization #105

Open
exarkun opened this issue Oct 23, 2023 · 2 comments
Open

zfec.Encoder and zfec.Decoder leak memory on re-initialization #105

exarkun opened this issue Oct 23, 2023 · 2 comments

Comments

@exarkun
Copy link
Member

exarkun commented Oct 23, 2023

Each call to __init__ allocates memory for the fec matrix. When the object is collected, only the most recently allocated matrix is freed.

Observable with this program:

import zfec

e = zfec.Encoder(255, 256)
for i in range(100000):
    e.__init__(255, 256)

memory usage will grow as the program runs.

Encoder and Decoder should probably refuse multiple __init__ calls.

@itamarst
Copy link

... why would anyone call __init__ multiple times?

@exarkun
Copy link
Member Author

exarkun commented Oct 25, 2023

... why would anyone call __init__ multiple times?

Other than to cause memory to leak? I can't think of a good reason.

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