-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blob URL leak #55
Comments
https://github.com/substack/webworkify/blob/v1.2.1/index.js#L66 Seems browserified version was assembled with old version of |
Fixed in 2.0.3, thanks for report! |
@fuerte656 BTW, could you explain your use case for |
I use Pica since version 1.0.7 |
Thanks for info. |
browserify/webworkify#26 seems changes were rolled back due IE Edge bug. Anyway, webworers are cached for several seconds, and intensive use will not create a bulk of leaked objects. I think, problem will be self-resolved in future |
We have encountered a problem with Pica when processing large amounts of images (i.e. 1000+). When we resize multiple images through Pica, eventually it stops working, and when we look into the Network tab of the Developer Tools (on Chrome), we can see a corrupted Blob URL (empty).
I have taken a look at the Pica's source code and found that Pica creates Blob URLs using the
URL.createObjectUrl
to pass them to the worker constructor. There is a code like this:The documentation for
URL.createObjectURL
says that you have to release these URLs when they are no longer needed using theURL.revokeObjectURL
:https://developer.mozilla.org/en/docs/Web/API/URL/createObjectURL
However, in the code above, the created Blob URL is not released and apparently gets orphaned. As a result, when too many Blob URLs are created, the
URL.createObjectURL
starts failing (perhaps, it reaches some browser's limit for a number of Blob URLs).I was going to patch Pica to save a reference to the Blob URL and revoke it when the worker is terminated, but I have updated to 2.0.2 and found out that the
resizeBuffer
method does not use workers anymore. So this update works for me, but you may want to fix it for theresizeCanvas
method.The text was updated successfully, but these errors were encountered: