Open Jove125 opened 8 months ago
I'm not sure there is anything we can here since then you close a tab of refresh a page I think its up the browser to completely free everything on that page, including the workers.
@kripken is that your understanding too? Or is there something more we can do here? @RReverser might have some ideas too.
Yeah it should be completely freed, otherwise it's a specific browser's bug and worth reporting there. That said, I remember @juj running into similar bug with memory not being released properly when using threads, maybe they can chime in.
I recall seeing memory unloading related problems in Chrome when I was investigating trouble around this issue: https://github.com/WebAssembly/threads/issues/176 . Though iirc that issue did get fixed in Chrome. (could not find the bug report in Chrome right now)
If you are seeing issues, I recommend trying to reduce the issue in a small test case, where you repeatedly alloc tabs until leaking, and then report it up to Chrome browsers to look?
Hi,
How to completely release memory when an application terminates? For example, when refreshing a page or moving to the another page?
The error (not enough memory) only occurs when refreshing a page with the multi-threaded version of opencv (build with --threads flag) and does not occurs with the single-threaded version. And only on devices with 3 GB of RAM.
I tried release memory like this, but it didn't help:
It seems that the memory is not release or it does not release immediately on page refresh. Therefore, when opening the application again in the same tab, an error occurs.
P.S. I had exactly the same error with Tensorflow.js. It was successfully resolved after memory was released on the window.onbeforeunload event. There the memory release function looks like this:
Is there the same function in opencv.js? Is there a way to simply reset the wasm memory when the application terminates?