WebGLBindingStates: Memory leak in needsUpdate().
See original GitHub issueDescribe the bug
There’s a very interesting memory leak introduced at some point
What it does is crease 2 arrays every time the method is called (via Object.keys) just to compare their lengths. In my basic performance tests - I saw this little gem contribute to about 35% of GC overhead in my application or around 1kb per frame.
To Reproduce
Steps to reproduce the behavior:
- Go to https://threejs.org/examples/#webgl_instancing_performance
- Click on the mouse
- See error in usage of allocations, after you run an allocation recording
Code
if ( Object.keys( cachedAttributes ).length !== Object.keys( geometryAttributes ).length ) return true;
Live example
Expected behavior
No allocations expected to be performed
Screenshots
If applicable, add screenshots to help explain your problem (drag and drop the image).
Platform:
- Device: [Desktop]
- OS: [Windows]
- Browser: [Chrome, Firefox]
- Three.js version: [r??? - yes, 122]
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Three.js memory leak - Stack Overflow
The dynamic memory allocation/deallocation example is leaking not only @ the example link: ... needsUpdate = true; var material = new THREE.
Read more >Memory leak issue in chrome - Questions - three.js forum
I need to create a THREE.Group containing ~600 object. The objects inside this group need to be recreated with a high frequency.
Read more >Understanding Memory Leaks in Nodejs | by Chidume Nnamdi
In this post, we will learn, using examples, about memory leaks in Nodejs and how we can solve them. In our effort to...
Read more >JScript Memory Leaks - Douglas Crockford
In it, the purge function is called just before deleting DOM elements. Note that handlers that were added with attachEvent() will not be...
Read more >A tale of three(.js) snapshots and Angular 2 or how memory ...
A tale of three(.js) snapshots and Angular 2 or how memory leaks! ... destroyed through the use of the ngOnDestroy() hook that it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Usnul, thanks for the report. I think this report is meaningful. Would you please update the issue comment with the bug report template because I don’t want this report to be deleted?
I came up with a solution. Would you please share the test with me to check if it works? Or could you test in your side for me if I make a PR?
@Mugen87 isnt it just to quit early before checking values