Preventing memory leak with detectAllFaces() ?
See original GitHub issueI am using detectAllFaces()
with TinyFaceDetector
. Every 500ms I feed it a new image to analyze. I noticed that I’m getting a memory leak because new canvas
elements keep getting created and are never disposed of (I can see them in the Developer Tools’ Canvas tab).
What is the proper way to dispose of all these temporary canvas
?
P.S. Thanks for a great library!
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Avoid memory leaks with promises and loop in coffee-script ...
The solution was to dispose the tensor copy sent to detectFaces. faceapi.detectAllFaces(_tensorFrame, @faceDetectionOptions).then ...
Read more >How to Find, Fix, and Prevent Node.js Memory Leaks
Memory management for any application is essential. This post looks at what memory leaks are and how to avoid them in Node.js applications....
Read more >Causes of Memory Leaks in JavaScript and How to Avoid Them
In this article, we will explore programming patterns that cause memory leaks in JavaScript and explain how to improve memory management.
Read more >Understanding memory leaks in node.js part 1 - alxolr
Internals. In node.js the status of your memory can be tracked with the following command process.memoryUsage() which returns the following JSON:.
Read more >Memory Leaks in JavaScript and how to avoid them. - Medium
hugeString is kept in memory until the app stops, although never used. function setCallback() { const data = { counter: 0, hugeString: new...
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
Hey Jean-Philippe 😃
Yes, this is correct.
They should get garbage collected, otherwise you will run out of memory pretty quickly. Maybe you can share some code of what you are doing? If these canvases do not get garbage collected, then there is probably some reference dangling around somewhere.
Maybe you are unintenendly storing the NetInputs on some global object? Maybe the Dev Tools you are using itself cause the memory leak, because it is holding references to the canvases for debugging purposes. Same goes for logging the objects to the console, which will prevent them from being garbage collected until you clear your console.
i have same issue.