Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

yod9999

macrumors newbie
Original poster
Jan 6, 2007
21
0
hi

sorry if this is a fairly stupid question, but i've never really done any web programming before.

i've created a really simple widget do display a picture from a webcam on the dashboard, it uses javascript to refresh the image once a second.

Code:
<html>
<head>
<script type="text/javascript">
function fetchImage()
{
	var now = new Date();
	var zm_image = new Image();
	zm_image.src = 'http://195.243.185.195/axis-cgi/jpg/image.cgi?resolution=360x240&camera=1&compression=50'+'&'+now.getTime();

	document['zmImage'].src = zm_image.src;
	
	delete zm_image;
}

window.setInterval( "fetchImage()", 1000 );
</script>

</head>
<body>
<img name="zmImage" src="http://195.243.185.195/axis-cgi/jpg/image.cgi?resolution=360x240&camera=1&compression=50" alt="BackGarden" border="0" width="320" height="240">	
</body>

</html>

i told you it was simple :) (the url is just a random one i picked off the net)

the problem is that the widget process seems to use a huge amount of memory. each image is about 16kb, but 5 minutes after launching the widget in activity monitor the dashboard client process shows as using 107MB of real memory and 450MB of virtual memory. the figures are fairly stable once they reach these levels so it's not like there's a proper memory leak, but it does seem like an excessive amount of memory. is this normal/a problem? is there anything i can do to reduce the amount of memory used?

cheers

yod
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.