question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serious memory leak in Resource in node.js and other environments caused by RequestScheduler.activeRequests

See original GitHub issue

The Issue

When using sampleTerrainMostDetailed often (thousands of times), the memory usage slowly rises.

Inspections

In node this leads to a large external memory usage over time. We managed to replicate the problem in the browser (see this sandcastle gist). This leads to the following profile over 90 seconds: Capture

For some reason, the listeners keep on rising, we are currently trying to get to the bottom of this and would welcome any input.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jbo023commented, Mar 22, 2019

@shunter Thanks, when i add RequestScheduler.update() after each sampleTerrain call the memory footprint keeps stable. Maybe this could be documented for methods which can be used without the render loop?

0reactions
mramatocommented, Mar 9, 2020

I somehow missed this issue the first time around but @kring just ran into it.

Couldn’t we just have RequestSchedule run update on itself no more than once a frame? Rather than installing a constant even into the event loop, we could have it use process.nextTick and only install the one time handler after a request has resolved.

I may not be explaining it well, but I think this is an easy fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging Memory Leaks in Node.js Applications - Toptal
Memory leaks in long running Node.js applications are like ticking time bombs that, if left unchecked in production environments, can result in devastating ......
Read more >
Node.js Memory Leak Detection: How to Debug & Avoid Them
Learn what Node.js memory leaks are. Discover common causes and go through the whole debugging process, from detection to fixing and ...
Read more >
Memory leaks in NodeJS application?! | by Gaspar Nagy
What can cause a memory leak? Global Variables. They stay in memory until the application stops. That's why it is dangerous to set...
Read more >
Understanding memory leaks in Node.js apps - LogRocket Blog
In this article, we are going to learn what memory leaks are, what causes them, and their implications in a Node.js application.
Read more >
[Bug]: Memory consumption issues on Node JS 16.11.0+ ...
0) because of this issue. We bisected the changes and identified that the upgrade from Node 16.10 to 16.11 caused our large Jest...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found