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

pendulum.parse memory leak #720

Open
2 tasks done
meehand opened this issue Jul 14, 2023 · 1 comment
Open
2 tasks done

pendulum.parse memory leak #720

meehand opened this issue Jul 14, 2023 · 1 comment

Comments

@meehand
Copy link

meehand commented Jul 14, 2023

  • I am on the latest Pendulum version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • Ubuntu 20.04
    -2.1.0 - 2.1.2

Issue

There is a memory leak if pendulum.parse() throws an exception. This started in 2.1.0 and has persisted to 2.1.2.

Leak in 2.1.0 and not 2.0.5:

import pendulum
import psutil

for index in range(1000000):
    try:
        pendulum.parse("FAIL")
    except Exception:
        pass

    if index % 1000 == 0:
        print(f"iteration {index} memory usage {psutil.Process().memory_full_info().rss / 1024} kb")

No leak:

import pendulum
import psutil

for index in range(1000000):
    try:
        pendulum.parse("2021-04-08 14:23:30")
    except Exception:
        pass

    if index % 1000 == 0:
        print(f"iteration {index} memory usage {psutil.Process().memory_full_info().rss / 1024} kb")
@xzmeng
Copy link

xzmeng commented Sep 19, 2023

This bug has been fixed in #563, however, the latest pypi release 2.1.2 is three year ago. And the C extension has been rewritten in Rust, anyway ... it is fixed in master branch ...

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