Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Firefox 3.0.12 and memory allocation for img document objects, dynamicly created by createElement method

19 views
Skip to first unread message

wDevil

unread,
Aug 5, 2009, 11:18:08 PM8/5/09
to
Example:
var images = new Array();
for(i=0; i < 2000; i++) {
var img = document.createElement('img');
img.src='http://localhost/drawer/'+i;
images.push(img);
}
drawer return png images.
Firefox now use 300MB of memory. Then i delete array of objects. But
after that Fiefox don't free allocated memory for this images. Why?

su weisi

unread,
Aug 6, 2009, 8:27:18 AM8/6/09
to wDevil, dev-tech-...@lists.mozilla.org
Hi

<input type="button" value="test1" onclick="test1()" />
<input type="button" value="purge" onclick="test()" />

<script>
function test1(){


images = new Array();
for(i=0; i < 2000; i++) {
var img = document.createElement('img');
img.src='http://localhost/drawer/'+i;
images.push(img);
}
}

function test(){
for (i=0;i<2000 ;i++ )
{
images[0]=null;
}
images=null;
}
</script>

i tried to run this code, when i clicked on the test1, the task manager
showes the firefox.exe increased by 30mb memory usage, and it takes around
15 seconds the firefox.exe memory usage go down and keep as the same as you
didn't click on the test1 on firefox 3.52, is this the same on your
platform?

> _______________________________________________
> dev-tech-javascript mailing list
> dev-tech-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-javascript
>

0 new messages