optimisation empreinte mémoire.
authorBenoît Pin <pin@cri.ensmp.fr>
Wed, 24 Jul 2013 11:34:37 +0000 (13:34 +0200)
committerBenoît Pin <pin@cri.ensmp.fr>
Wed, 14 Aug 2013 10:33:12 +0000 (12:33 +0200)
skins/fileupload.js

index 8f6eeda..c202bfe 100644 (file)
@@ -93,8 +93,10 @@ DDFileUploader.prototype.uploadCompleteHandler = function(req) {
        var fragment = getCopyOfNode(req.responseXML.documentElement.firstChild);
        var img = fragment.getElementsByTagName('img')[0];
        img.onload = function(evt) {
        var fragment = getCopyOfNode(req.responseXML.documentElement.firstChild);
        var img = fragment.getElementsByTagName('img')[0];
        img.onload = function(evt) {
-               var preview = slide.getElementsByTagName('img')[0];
-               preview.src = undefined;
+               // accelerate GC before replacing
+               slide.img.src = '';
+               slide.img.parentNode.removeChild(slide.img);
+               slide.img = undefined;
                slide.parentNode.replaceChild(fragment, slide);
        };
        this.previewsLoaded--;
                slide.parentNode.replaceChild(fragment, slide);
        };
        this.previewsLoaded--;