python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.44k stars 587 forks source link

Fixing memory leak that leaves values and callbacks in memory indefinitely #542

Open nosachamos opened 2 years ago

nosachamos commented 2 years ago

Keeping track of return values that arrive before callbacks are registered, and then delivering to the callbacks when they are registered.

This fixes a major memory leak currently in Eel, as reported in https://github.com/ChrisKnott/Eel/issues/540

Tested extensively locally.

See that values no longer accumulate when many rapid calls to JS are performed:

image

nosachamos commented 2 years ago

@ChrisKnott this is an important one... may warrant a new release, perhaps?

ChrisKnott commented 2 years ago

@ChrisKnott this is an important one... may warrant a new release, perhaps?

Yes, I think so. One thing I never really thought about was that people would make apps with Eel that run for hours.

I have had a lot of Life Stuff last couple of years but from this week I will have Friday afternoons free so hopefully I can finally get back to making progress on this project. It's kind of got away from me atm 😅...

samuelhwilliams commented 1 year ago

Hey @nosachamos - this looks like it'd be really good for us to get in. I'm aware it's been a long time since you contributed this - sorry.

If you still have context, do you think you'd be able to add a test that can demonstrate the memory leak is fixed (and will therefore protect against regressions in the future)