[ad_1]
I’ve an internet app that hundreds pictures from a zipper file, and shows them successively.
The zip file can retailer many pictures.
To forestall from working out of reminiscence, the reminiscence is managed, by cleansing the reminiscence from earlier pictures earlier than exhibiting the subsequent picture.
That is executed by:
- setting the buffer to null.
- revoking the thing url and setting the url to null.
This strategy works nicely on numerous OSs comparable to Home windows, Linux, and MacOS.
However on iOS it fails.
I narrowed the issue right down to the creation and cleansing of the url from blob.
To simplify the debugging I eliminated the usage of zip file and as a substitute, load the pictures from exterior url.
To imitate the habits when loading from zip file, I artifically
fetch the blob from the url, create an object url through createObjectURL, and clear the thing url through revokeObjectURL
Ideally, there shouldn’t be any reminiscence leak as I am cleansing the thing url, however there may be.
After a finite variety of pictures, the load fails.
An instance of the issue will be seen right here:
https://jsfiddle.internet/avnerm/vd8cwy9g/5/
Setting the variable doDebugMemoryLeakOn_iOS_withRevoke to true, prompts the instructions
URL.createObjectURL();
URL.revokeObjectURL();
which trigger the issue, after a while (after ~400 pictures on my iPad Professional).
This occurs on numerous iOS gadgets (e.g. iPad, iPhone8) with numerous iOS variations (iOS 15.2, iOS 14.8.1)
when performed in numerous browsers (e.g. Safari, Chrome, Firefox) after about 1000 pictures.
It additionally occurs in a local iOS app that makes use of WKWebView.
I believe that there could also be an issue with the WKWebView browser engine, which is frequent to all these browsers.
May this point out a bug in WKWebView?
How can this be mounted, or labored round?
Thanks
[ad_2]
