Quantcast
Channel: Internet Explorer 8, 9, 10, 11 forum
Viewing all articles
Browse latest Browse all 10469

changing img.src cause memory leak

$
0
0

I try to generate thumbnail with HTML5 canvas

the idea is simple, use img to load and draw to canvas

function createThumbnail(url){

var img = new Image();
img.onload = function(){
    var context = canvas.getContext('2d');
    context.drawImage(...);
    context = img = null;
}
img.src = url;

}

but some how i found that even i have set the img = null, but the memory usage (monitor in task manager) are keep growing.
when i rapidly call the createThumbnail method the memory usage are growing and finally "Not enough available storage to complete this operation" will throw at the line where img.src = url
at this point memory usage are 1gb+ 

I have try to reuse img object but still same.

this is happen on IE10 (8,9 not tested) but no Chrome and Opera

Any idea? 

Thank you very much.


Viewing all articles
Browse latest Browse all 10469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>