Closed Bug 941001 Opened 11 years ago Closed 11 years ago

contacts should call revokeObjectURL() on discarded image URLs

Categories

(Firefox OS Graveyard :: Gaia::Contacts, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bkelly, Assigned: bkelly)

Details

(Keywords: perf, Whiteboard: [c=memory p=1 s= u=][memshrink])

Attachments

(1 file)

Currently contacts app uses URL.createObjectURL() when referencing image blobs for contact portraits.  When a new image is set for a contact, however, we do not call revokeObjectURL() on the old URL.  This causes us to potentially hold on to more memory than necessary.
This pull request calls revokeObjectURL() when we clear or change the img.dataset.src attribute.

Note, I did not end up using the code that saves the URL in the js hash because it would have caused us to keep all images in memory.  With this patch we should now actually free the memory for images not on screen as we intended to do.
Attachment #8335297 - Flags: review?(jmcf)
Jose, thanks for the comments on Github!  I've updated the PR to warn if createObjectURL() throws and to improve the conditional logic as requested.
Comment on attachment 8335297 [details] [review]
Pull request at https://github.com/mozilla-b2g/gaia/pull/13873

just one additional nit on GH.

Once fixed and a green Travis got please land it

thanks!
Attachment #8335297 - Flags: review?(jmcf) → review+
Thanks!  Travis is green, so merged:

  https://github.com/mozilla-b2g/gaia/commit/6cfb6f8cdfe185e37936ce2ed652ed8b9869f520
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: