Bug 78794 - Memory usage grows infinitely when changing img.src
Summary: Memory usage grows infinitely when changing img.src
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P1 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-16 02:56 PST by istvan.bender
Modified: 2019-05-02 16:18 PDT (History)
8 users (show)

See Also:


Attachments
Test page to reproduce bug (2.81 KB, text/html)
2012-02-16 02:56 PST, istvan.bender
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description istvan.bender 2012-02-16 02:56:29 PST
Created attachment 127345 [details]
Test page to reproduce bug

I create a page, that refreshes images frequently. I experience that memory usage grows infinitely.

I tested on Windows 7, Chrome version: 18.0.1025.11 and Mac OS 10.7.3 Lion Chrome version: 17.0.963.56. It leaks on both platform.
I also tested on Firefox 11.0 on both platform and the memory usage was stable.

How to reproduce?

1. Open attached image-test.html
2. Press Start
3. Check memory usage of page

I would expect the memory usage won’t grow (memory consumption relatively constant) in the long run.
I tested BlobBuilder API separately, it doesn’t leak alone. So it seems to me that changing img.src frequently causes the memory leak.
Comment 1 Alexey Proskuryakov 2012-02-16 10:15:01 PST
See also: bug 31253.
Comment 2 istvan.bender 2012-02-17 00:47:43 PST
Yesterday Safari 5.2 was released for OS X. I tested it on Mac OS 10.7.3 Lion and it leaks again. So it seems to me it's a WebKit bug.
Comment 3 Mohamed Mansour 2012-02-26 15:42:07 PST
I believe this only happens when the web inspector is opened. It leaks really fast.
Comment 4 istvan.bender 2012-02-27 00:26:48 PST
(In reply to comment #3)
> I believe this only happens when the web inspector is opened. It leaks really fast.

Yes, we realized with web inspector leaks faster, but it leaks without web inspector as well.
Comment 5 wxengineer 2013-02-02 00:55:24 PST
Change Img src will cause memory leak in Qt webkit , this sample will cause memory leak very fast, where I can get the patch ? 

<!DOCTYPE html>
<html>
<!-- 2013-02-2 -->
<head>
<title>imge memory leak test</title>
</head>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
var page_index = 0;
var page_size = 8;
var total_page = 10;
var test_img = [
"http://imgsrc.baidu.com/forum/pic/item/01bb15d82f9b267032fa1cf8.jpg",
"http://www.qianyan001.com/img1/images/mm/qcmn/1-111126225321.jpg",
"http://www.xiguanyigeren.cn/UploadPic/2010-6/%E6%B8%85%E7%BA%AF%E5%8F%AF%E7%88%B1%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%871.jpg",
"http://g.hiphotos.baidu.com/album/s%3D1600%3Bq%3D90/sign=427a01bdd688d43ff4a995f44d2ee96a/d8f9d72a6059252d6a53bbcc349b033b5ab5b9b6.jpg",

"http://postimg1.mop.com/2010/12/28/1293523608798423.jpg",
"http://e.hiphotos.baidu.com/album/s%3D1600%3Bq%3D90/sign=1ba9820976c6a7efbd26ac20cdca9420/f9198618367adab4b6553c958bd4b31c8601e45b.jpg",
"http://img10.3lian.com/c1/newpic/05/28/195.jpg",
"http://ww2.sinaimg.cn/large/8875757cjw1dyr61mavzrj.jpg",

"http://www.qhstv.com/img/b01-0928-015129.jpg",
"http://f.hiphotos.baidu.com/album/s%3D1600%3Bq%3D90/sign=7e56f128f703918fd3d139cc610d1de6/bd3eb13533fa828bbb6f3b2bfd1f4134960a5aad.jpg",
"http://imgsrc.baidu.com/forum/pic/item/60a4a5c2aeb8f3400ff47756.jpg",
"http://sjrjy.apkzz.net/201010/04135909859e3614936993.png",

"http://imgsrc.baidu.com/forum/pic/item/863d0cf4e4d69a837709d7e3.jpg",
"http://www.taopic.com/uploads/allimg/101102/292-1011020I9430.jpg",
"http://pic1.nipic.com/20090325/2288834_201014043_2.jpg",
"http://e.hiphotos.baidu.com/album/s%3D1600%3Bq%3D90/sign=992225f83af33a879a6d041cf66c2b49/5366d0160924ab18db3047ff35fae6cd7a890bd7.jpg",

"http://f.hiphotos.baidu.com/album/s%3D1600%3Bq%3D90/sign=4c1188b64fc2d562f608d4ebd721ab9e/f703738da97739124632a3b7f8198618377ae2d4.jpg",
"http://h.hiphotos.baidu.com/album/s%3D1600%3Bq%3D90/sign=2c578cb70fb30f24319ae805f8a5ea32/b17eca8065380cd7c6fd853ba144ad3458828100.jpg",
"http://g.hiphotos.baidu.com/album/s%3D1600%3Bq%3D90/sign=5139c5db70cf3bc7ec00c9eae13081d0/730e0cf3d7ca7bcb3c76fef9be096b63f724a8d2.jpg",
"http://g.hiphotos.baidu.com/album/s%3D1600%3Bq%3D90/sign=c49b02eeb3de9c82a265fd895cb1bb7b/f3d3572c11dfa9ecdcd0b0c062d0f703908fc16f.jpg",

"http://pic6.nipic.com/20100331/3483942_093020546339_2.jpg",
"http://pic5.nipic.com/20100117/2618716_191816419613_2.jpg",
"http://pic15.nipic.com/20110619/1901904_133017602175_2.jpg",
"http://pic6.nipic.com/20100405/4624024_120218259131_2.jpg",

"http://pic6.nipic.com/20100327/3108870_075806043175_2.jpg",
"http://pic6.nipic.com/20100331/3483942_093017662763_2.jpg",
"http://a3.att.hudong.com/81/45/01300001036541128808456409246.jpg",
"http://pic6.nipic.com/20100326/3108870_081742039862_2.jpg",

"http://pic11.nipic.com/20101209/4717883_141748077862_2.jpg",
"http://pic.nipic.com/2007-11-21/2007112110365952_2.jpg", 
"http://pic7.nipic.com/20100511/4904486_215341087980_2.jpg",
"http://pic6.nipic.com/20100331/3483942_093020516707_2.jpg",

"http://img2.ooopic.cn/uploadfilepic/sheji/2010-01-15/OOOPIC2_1982zpwang407_20100115a16ad62d0c7f6a2b.jpg",
"http://pic6.nipic.com/20100412/3483942_194519635128_2.jpg",
"http://a2.att.hudong.com/15/68/01300000329163124711682450215.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-08-11/OOOPIC_SHIJUNHONG_2009081111b304b51aa7e350.jpg",

"http://pic1.ooopic.com/uploadfilepic/sheji/2009-09-01/OOOPIC_wenneng837_2009090142f8d6c8c5465915.jpg",
"http://pic4.nipic.com/20091113/2036281_160832616864_2.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheying/2009-08-28/OOOPIC_wenneng837_20090828a1a496c3b125af9c.jpg",
"http://pic.nipic.com/2008-01-19/2008119152614762_2.jpg",

"http://img10.3lian.com/c1/newpic/10/08/35.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-08-29/OOOPIC_wenneng837_20090829a095f6165c858a02.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheying/2009-04-14/OOOPIC_373354331_20090414be707d0d03a6e787.jpg",
"http://img10.3lian.com/c1/newpic/12/04/22.jpg",

"http://img1.ooopic.com/uploadfilepic/sheji/2009-08-06/OOOPIC2_SHIJUNHONG_200908067875fdc864395db9.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-08-05/OOOPIC_SHIJUNHONG_2009080512baf545c70ff9fb.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-08-29/OOOPIC_wenneng837_20090829ffeb6259232f87c8.jpg",
"http://www.0833net.cn/uploads/allimg/101207/1_101207193654_1.jpg",

"http://img10.3lian.com/c1/newpic/05/22/29.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-08-06/OOOPIC_SHIJUNHONG_2009080634c0b00d3c253824.jpg",
"http://pic6.nipic.com/20100412/3483942_203900578181_2.jpg",
"http://img10.3lian.com/c1/newpic/10/08/43.jpg",

"http://pic1.ooopic.com/uploadfilepic/sheji/2009-09-12/OOOPIC_wenneng837_200909122b2c8368339dd52a.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-08-29/OOOPIC_wenneng837_2009082914ab7f508a8cbbf2.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-10-13/OOOPIC_caihaiming_20091013dcd80110980b5b65.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-08-12/OOOPIC_SHIJUNHONG_20090812cc26f34a822eafeb.jpg",

"http://img1.ooopic.com/uploadfilepic/sheji/2009-10-13/OOOPIC2_caihaiming_20091013352f72c70329b3d0.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-09-12/OOOPIC_wenneng837_2009091297c672b936b1a924.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-09-12/OOOPIC_wenneng837_20090912a1ac0ee610475069.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-05-05/OOOPIC_vip4_200905050af1477c0089b3aa.jpg",

"http://pic3.nipic.com/20090529/2495506_142828062_2.jpg",
"http://pic2.ooopic.cn/uploadfilepic/sheji/2009-08-06/OOOPIC_SHIJUNHONG_20090806c39478f151b2582e.jpg",
"http://img10.3lian.com/c1/newpic/09/12/52.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-10-13/OOOPIC_caihaiming_2009101321bb40c3050d4e9f.jpg",

"http://pic1.ooopic.com/uploadfilepic/yuanwenjian/2009-09-04/OOOPIC_89153184_200909045fa89ca44631dda2.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-09-12/OOOPIC_wenneng837_20090912031b8fa24d663698.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-09-12/OOOPIC_wenneng837_2009091201362741c38fcf84.jpg",
"http://pic3.nipic.com/20090508/2537030_000400452_2.jpg",

"http://pic1.ooopic.com/uploadfilepic/sheji/2009-08-29/OOOPIC_wenneng837_20090829bd97bfe0cb5c9734.jpg",
"http://img10.3lian.com/c1/newpic/10/23/48.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-09-12/OOOPIC_wenneng837_2009091207bf00fa32712874.jpg",
"http://img10.3lian.com/c1/newpic/10/23/09.jpg",

"http://img10.3lian.com/c1/newpic/05/19/02.jpg",
"http://pic.chefu.com.cn/UserFiles/File/picture/sPicture/81.jpg",
"http://pic1.ooopic.com/uploadfilepic/sheji/2009-09-12/OOOPIC_wenneng837_20090912db9601fe005e6bf7.jpg",
"http://img10.3lian.com/c1/newpic/10/22/12.jpg",
"http://img10.3lian.com/c1/newpic/10/23/47.jpg",
"http://img10.3lian.com/c1/newpic/05/28/218.jpg",
"http://img10.3lian.com/c1/newpic/05/31/22.jpg",
"http://img10.3lian.com/c1/newpic/10/08/53.jpg",
];

function loadCurPage()
{
     var e=$("#srcPic");
     e.empty();
     for (var i=0;i<page_size;i++)
     {
         console.log("xxxxxx : " + test_img[page_size*page_index+i]);
         $("<img src=\""+test_img[page_size*page_index+i]+"\" />").attr({width:'220px', height:'180px'}).appendTo(e);
     }
/*
     for (var i=0;i<page_size;i++)
     {
         console.log("xxxxxx : " + test_img[page_size*page_index+i]);
         document.getElementById("mm"+i).src = test_img[page_size*page_index+i];
     }
*/
}

document.onkeydown = function(e) {
	var keyCode = e.which | e.keyCode;
	//var keyCode = window.event.keyCode;
	e.preventDefault();
	console.log(keyCode);
	switch(keyCode) {
        case 37:
        console.log("key left : " + page_index);
        break;

        case 38:
        console.log("key up : " + page_index);
        page_index++;
        page_index %= total_page;
        break;

        case 39:
        console.log("key right : " + page_index);
        break;

        case 40:
        console.log("key down  :" + page_index);
        if(page_index > 0)
            page_index--;
        else
            page_index = total_page - 1;      
        break;
        
        default:
        break;
     }
     loadCurPage();
}
</script>

<body style="color: white; direction: ltr; line-height: normal; letter-spacing: normal; font-variant: normal; width: 1280px; background-repeat: repeat; list-style-type: decimal; position: absolute; height: 720px; left: 50px; top: 10px; background-color: transparent;" id="bd1">
<div id="srcPic" style="width: 980px; height: 620px;">
<script>
loadCurPage();
</script>
</div>
</body>
</html>
Comment 6 Brian Burg 2015-02-11 07:48:40 PST
Test page no longer works, because BlobBuilder was removed.