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

[BUG] Memory leak in __repr__ #59

Closed
squahtx opened this issue Jul 15, 2022 · 3 comments
Closed

[BUG] Memory leak in __repr__ #59

squahtx opened this issue Jul 15, 2022 · 3 comments
Labels
Type: Bug Something isn't working

Comments

@squahtx
Copy link

squahtx commented Jul 15, 2022

Similar to #55, __repr__ leaks memory.

OS version: Ubuntu 20.04.4 LTS
Python3 version (python3 -V -V): Python 3.8.10

Steps to reproduce

Borrowing code from #55:

import resource
import frozendict

print("frozendict version:", frozendict.__version__)
print()

c = 0
while True:
    fz = frozendict.frozendict({i: i for i in range(1000)})
    _repr = repr(fz)
    
    if (c % 10000) == 0:
        max_rss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
        print(f"iteration: {c}, max rss: {max_rss} kb")
    
    c += 1

Actual result

frozendict version: 2.3.2

iteration: 0, max rss: 11712 kb
iteration: 10000, max rss: 118104 kb
iteration: 20000, max rss: 224496 kb
iteration: 30000, max rss: 330888 kb
iteration: 40000, max rss: 437280 kb
iteration: 50000, max rss: 543672 kb
@Marco-Sulla
Copy link
Owner

Thank you again for the report.
It should be fixed in 3eb3c49 Can you confirm?

@squahtx
Copy link
Author

squahtx commented Jul 18, 2022

That seems to have fixed it. Thank for your the fast response!
Can we have a PyPI release with the fix?

@Marco-Sulla
Copy link
Owner

As already said, done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants