Skip to main content

Bug Tracker

Side navigation

#6944 closed bug (invalid)

Opened August 25, 2010 02:05PM UTC

Closed October 02, 2010 10:52PM UTC

Last modified March 15, 2012 01:46PM UTC

Mobile Safari memory leak with $("img").remove()

Reported by: musicisair Owned by:
Priority: undecided Milestone: 1.4.3
Component: unfiled Version: 1.4.2
Keywords: iPad, mobile safari, memory leak Cc:
Blocked by: Blocking:
Description

Related: http://stackoverflow.com/questions/2986039/ipad-iphone-browser-crashing-when-loading-images-in-javascript

I dont' have an iPad to test on so I can't create a test page, sorry.

However, it looks as though iPad's Safari does NOT deallocate memory for images that are removed from the DOM. An answer in the StackOverflow link above mentions that assigning a dataURI with an encoded 1x1 px gif as the "src" of the image should help safari deallocate the memory used for that image element.

Attachments (0)
Change History (3)

Changed October 02, 2010 10:52PM UTC by addyosmani comment:1

priority: → undecided
resolution: → invalid
status: newclosed

I've tested and confirmed that this is an issue with Mobile Safari itself and not actually a problem due to jQuery (or specifically $('img').remove()).

Mobile Safari generally has issues with JavaScript memory allocation which are down to the limits and actual implementation Apple have applied to that version of their browser.

If you read through the StackOverflow thread you will see that there are a few different solutions presented there that successfully allow you to workaround the JS memory allocation issue without any trouble.

Closing ticket.

Changed March 03, 2011 08:58AM UTC by anonymous comment:2

So we still don't have a solution to this problem?

Changed March 03, 2011 04:21PM UTC by musicisair comment:3

I thought that last iOS 4.1 update fixed it. Hm. guess not?