Serious memory leak in Resource in node.js and other environments caused by RequestScheduler.activeRequests
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
### 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](https://gist.github.com/bkuster/8aaf5658951d4e68f70e63f04221318a)). This leads to the following profile over 90 seconds:

For some reason, the `listeners` keep on rising, we are currently trying to get to the bottom of this and would welcome any input.
Contributor guide
Research direction
Reproduce the issue by calling sampleTerrainMostDetailed repeatedly, then inspect RequestScheduler.activeRequests and the listener count in the browser or Node.js. Use the linked Sandcastle gist and memory profile as references; done means repeated calls no longer cause external memory or listener usage to keep rising.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- performance, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100