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

Potential External Memory Leak - External Resources not being collected. #222

Open
ItsDaveB opened this issue Sep 15, 2023 · 2 comments
Open

Comments

@ItsDaveB
Copy link

ItsDaveB commented Sep 15, 2023

I've been doing some testing and I have noticed memory usage proportionally increasing when Lucid is consumed in a long running application. Over time this memory usage compounds, and eventually uses a machines full memory allowance, causing various memory exceptions from here on.

This occurs when used in the context of long running application, or one with looping. I can see memory marked as external consistently increases and does not get garbage collected. I have tested using various looping approaches, while loops, for loops, interval loops & async loops in an attempt to try and force this external resource cleanup.

Replication steps are using the Data.from() method to showcase this.
I can see the following:
-External memory constantly increasing in each loop. mainly proportionally, until application end.
-Heap used, increasing/decreasing (stable as expected).
-Rss constantly increasing.
-Array buffers increasing/decreasing (stable as expected).

image

When we reach the 100k loop, you can see the external memory in use is 209.05mb which is significant.
image

StackBlitz here demonstrates the code I used to test this and shows minimal replication steps, in a nodejs application: https://stackblitz.com/edit/node-wdg1xb?file=index.js

Heap performance profile of operation:
image

@yHSJ
Copy link

yHSJ commented Nov 1, 2023

Hey @dpbeaumont! You're absolutely right, there is a memory leak in Lucid. In fact, there are several. I left a brief explanation in the pull request I opened (#232) to fix this specific issue, and I will continue to open PRs to incrementally resolve memory management issues throughout the library whenever I can.

@SebastienGllmt
Copy link

This is already fixed in the CML develop branch, so it will go away once Lucid updates to the latest CML version

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

3 participants