On 04/19/2014 09:49 AM, Julien Wajsberg wrote:
Yes that's also a possibility I had in mind. Aren't we taking up
valuable memory if you keep the blob url valid? Or is that memory used
anyway, because the image is displayed, and as a result it would not
take more than what's already taken?
If it's a memory-backed Blob and that's the only reference to it, I
believe the answer is yes because you are keeping both the Blob JS
Object/its backing XPCOM object and its referenced data alive. If it's
backed by a file on disk such as a File/Blob reference provided by
IndexedDB, you're only keeping the smallish JS Object/XPCOM object alive
so it's less bad.
In general if you have a memory-backed Blob you really want to:
- Save it to IndexedDB or DeviceStorage immediately if you are going to
ever save it to those spots.
- Get a *new* reference to the Blob and forget all your old references
to the memory backed Blob.
To be super-clear, putting memory-backed 'fooBlob' to IndexedDB does not
change the nature of 'fooBlob'. It's still the same memory-backed Blob.
Andrew
_______________________________________________
dev-b2g mailing list
dev-b2g@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-b2g