Tastenkunst / brfv5-browser

Beyond Reality Face SDK - BRFv5 - Platform: Browser
229 stars 48 forks source link

Firefox memory leak in webworker example #21

Open mattrossman opened 4 years ago

mattrossman commented 4 years ago

When running the minimal__webworker__track_one_face.html example in Firefox, the webworker process gradually consumes more and more memory in the background. Eventually, the tracking becomes incredibly slow as too many resources have been consumed.

Here's a snapshot of my Mac's activity monitor after running the example for a few minutes, showing 2.38 GB memory consumption: activity monitor

The other single-threaded examples tend to maintain ~300 MB memory usage. I also don't experience this issue in Chrome. I'm thinking this may be a bug in Firefox itself, but I'm posting here in case there is a simple implementation fix.

mattrossman commented 4 years ago

I've opened an associated Firefox bug report here. One additional piece of info is that the webworker will start releasing memory back to reasonable levels if you switch tabs. I'm wondering if there is something in the brfv5 example that is handling the blur/focus events to contribute to this.