Closed Bug 956215 Opened 11 years ago Closed 11 years ago

Homescreen still uses data urls (pngs), wasting memory

Categories

(Firefox OS Graveyard :: Gaia::Homescreen, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED WONTFIX
1.4 S3 (14mar)

People

(Reporter: gal, Unassigned)

References

Details

(Keywords: memory-footprint, perf, Whiteboard: [c=memory p= s=2014.03.14 u=tarako] [MemShrink:P1] [~300KB], [systemsfe])

Attachments

(2 files)

Reported by njn. This is wasting valuable space on the 128MB device. From the main process: │ │ │ ├────583,404 B (01.41%) -- strings │ │ │ │ ├──364,816 B (00.88%) -- notable │ │ │ │ │ ├──184,368 B (00.45%) -- string(length=28946, copies=3, "data:image/png;base64,iVBORw0KGgoAAAANSUh... │ │ │ │ │ │ ├──184,320 B (00.44%) ── malloc-heap │ │ │ │ │ │ └───────48 B (00.00%) ── gc-heap │ │ │ │ │ ├──110,640 B (00.27%) -- string(length=17210, copies=3, "data:image/png;base64,iVBORw0KGgoAAAANSUhEU... │ │ │ │ │ │ ├──110,592 B (00.27%) ── malloc-heap │ │ │ │ │ │ └───────48 B (00.00%) ── gc-heap │ │ │ │ │ ├───61,488 B (00.15%) -- string(length=9114, copies=3, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA... │ │ │ │ │ │ ├──61,440 B (00.15%) ── malloc-heap │ │ │ │ │ │ └──────48 B (00.00%) ── gc-heap From the homescreen process: │ │ │ ├────198,632 B (01.75%) -- strings │ │ │ │ ├──118,832 B (01.05%) -- notable │ │ │ │ │ ├───61,456 B (00.54%) -- string(length=28946, copies=1, "data:image/png;base64,iVBORw0KGgoAA... │ │ │ │ │ │ ├──61,440 B (00.54%) ── malloc-heap │ │ │ │ │ │ └──────16 B (00.00%) ── gc-heap │ │ │ │ │ ├───36,880 B (00.32%) -- string(length=17210, copies=1, "data:image/png;base64,iVBORw0KGgoAAAA... │ │ │ │ │ │ ├──36,864 B (00.32%) ── malloc-heap │ │ │ │ │ │ └──────16 B (00.00%) ── gc-heap │ │ │ │ │ └───20,496 B (00.18%) -- string(length=9114, copies=1, "data:image/png;base64,iVBORw0KGgoAAAANSU... │ │ │ │ │ ├──20,480 B (00.18%) ── malloc-heap │ │ │ │ │ └──────16 B (00.00%) ── gc-heap
I really meant tarako? here but we don't have a flag for that.
blocking-b2g: --- → fugu?
We really should do that CSP that blocks the data scheme idea that jlebar had.
Blocks: 902559
Thats a great idea. ++jlebar. Can we do this selectively for our own apps only?
Whiteboard: [MemShrink]
I'm almost 100% sure that one of these is the marketplace icon. I also filed bug 956192 to get rid of data urls in building blocks (they will show up in the email app for instance).
Probably. I think we need a CSP extension though, IIRC it doesn't support blacklisting a set of schemes, only whitelisting a set.
fwiw, certified apps have a hardcoded csp in c++. I can add a "no data: url" rule there easily.
We shouldn't do it for all certified apps, just the ones Mozilla controls.
Nick, any chance that you can dump the entire images and attach them here? That would help quickly identifying whats up.
Jesse, can you provide a patch for reducing data urls memory and it's better for v1.3.
blocking-b2g: fugu? → 1.3?
Flags: needinfo?(jesse.ji)
James, if you guys have a patch please assign your engineer to this. I will grant you permissions to fully triage bugs (let me know if anyone else on your team should have the ability to change bug assignees). Thanks!
Whiteboard: [MemShrink] → [MemShrink] [tarako]
triage: 1.3+ to benefit tarako. to be conservative, estimated ~300 KB saving given we have 11 preloaded apps on home screen
blocking-b2g: 1.3? → 1.3+
Whiteboard: [MemShrink] [tarako] → [MemShrink] [tarako][~300KB]
1.3+ seems wrong. Shouldn't we have a separate flag for tarako? We can try to uplift to 1.3 but I wouldn't delay 1.3 for this.
(In reply to Andreas Gal :gal from comment #12) > 1.3+ seems wrong. Shouldn't we have a separate flag for tarako? We can try > to uplift to 1.3 but I wouldn't delay 1.3 for this. I'll bring up this concern at the drivers' meeting on Monday.
> Nick, any chance that you can dump the entire images and attach them here? > That would help quickly identifying whats up. I don't have a development B2G device. But the attached patch will allow somebody else to do it -- currently we truncate long strings shown in about:memory at 4096 chars. This patch increases that, which means the entire data URI will be shown. From that I assume it's possible to somehow get the original image back?
> From that I assume it's possible to somehow get the original image back? IIRC, you can paste it into a browser and it will show you the image. Also, given a JS heap dump you can figure out what is holding the big strings alive, though that may or may not be helpful.
(In reply to Joe Cheng [:jcheng] from comment #11) > triage: 1.3+ to benefit tarako. > to be conservative, estimated ~300 KB saving given we have 11 preloaded apps > on home screen Not all preloaded apps are using data urls, only the marketplace in the standard set.
On a fresh production gaia install, I only get one data: uri in the parent process and one in the homescreen. They are both the marketplace icon. What was the configuration used that led to the memory report from comment #0 ?
It looks same case as 944224. -- Keven
Who can review jesse's patch?
Flags: needinfo?(ttsai)
Flags: needinfo?(styang)
Attachment #8356037 - Flags: review?(crdlc)
Flags: needinfo?(styang)
Flags: needinfo?(ttsai)
Comment on attachment 8356037 [details] [diff] [review] remove_data_urls.patch Review of attachment 8356037 [details] [diff] [review]: ----------------------------------------------------------------- We can't have this kind of dependencies in the homescreen. What needs to be done is simply fix the marketplace app so that it includes the icon in its package.
Attachment #8356037 - Flags: review?(crdlc) → review-
cvan, can you take that?
Flags: needinfo?(cvan)
Well, in my opinion, what we can do is not only simply fixing the marketplace app icon, but also providing a mechanism to ensure there is no data url any more or replacing a data-url with a local path in some special cases. (In reply to Fabrice Desré [:fabrice] from comment #20) > Comment on attachment 8356037 [details] [diff] [review] > remove_data_urls.patch > > Review of attachment 8356037 [details] [diff] [review]: > ----------------------------------------------------------------- > > We can't have this kind of dependencies in the homescreen. What needs to be > done is simply fix the marketplace app so that it includes the icon in its > package.
Flags: needinfo?(jesse.ji)
Jesse, I agree with you but for that we need a patch that transparently converts the data uri into a blob and back as needed. Thats the ideal solution. We can probably get by with the cache purging since we do that whenever the homescreen goes into the background.
Whiteboard: [MemShrink] [tarako][~300KB] → [MemShrink:P1] [tarako][~300KB]
Is there anything left to do here? We've fixed the icons issue on the marketplace side in a different bug.
Eve
Evelyn will file other bug for each app that uses data url. -- Keven
(In reply to Keven Kuo [:kkuo] from comment #26) > Evelyn will file other bug for each app that uses data url. > > -- > Keven For tarako, there is only browser app using data url, and I filed bug 958433 for it. However, after analysis and discussed with Ben on the bug, the benefit of memory saving (40k) doesn't justify the risk of a making this change in 1.3.
This is a blocker for tarako, but not 1.3.
blocking-b2g: 1.3+ → 1.3?
Moving to 1.3T+ per bug comments
blocking-b2g: 1.3? → 1.3T+
1.3T means tarako, remove [tarako] in whiteboard
Whiteboard: [MemShrink:P1] [tarako][~300KB] → [MemShrink:P1] [~300KB]
Keywords: perf
OS: Mac OS X → Gonk (Firefox OS)
Priority: -- → P1
Hardware: x86 → ARM
Whiteboard: [MemShrink:P1] [~300KB] → [c=memory p= s= u=tarako] [MemShrink:P1] [~300KB]
hi Evelyn, is this something you can work on for Tarako? Thanks
Flags: needinfo?(ehung)
I thought the bug has been fixed after bug 944224 (see comment 18). Is there anything we want to do here?
Flags: needinfo?(ehung) → needinfo?(jcheng)
let this goto tarako triage. 1.3T?
blocking-b2g: 1.3T+ → 1.3T?
Flags: needinfo?(jcheng)
NO on :fabrice to check if this is still needed for 1.3T given the marketplace fix.
Flags: needinfo?(fabrice)
Whiteboard: [c=memory p= s= u=tarako] [MemShrink:P1] [~300KB] → [c=memory p= s= u=tarako] [MemShrink:P1] [~300KB], [systemsfe]
The marketplace fix is good, nothing to do here anymore.
blocking-b2g: 1.3T? → ---
Flags: needinfo?(fabrice)
Flags: needinfo?(cvan)
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
Keywords: footprint
Whiteboard: [c=memory p= s= u=tarako] [MemShrink:P1] [~300KB], [systemsfe] → [c=memory p= s=2014.03.14 u=tarako] [MemShrink:P1] [~300KB], [systemsfe]
Target Milestone: --- → 1.4 S3 (14mar)
I'm still seeing lots of images encoded as data: URIs on a trunk build on my Buri. The marketplace icon is the main offender. I identified the images using the techniques in comment 14 and comment 15 -- increase the notable string max length for about:memory and then paste the URI into the browser address bar, and it displays the image. -------- Ones showing up as JS strings -------- Main Process, within the system zone: - 430,192 B -- length=28946, copies=7 -- marketplace icon, 120x120 - 258,160 B -- length=17210, copies=7 -- marketplace icon, 90x90 - 143,472 B -- length=9114, copies=7 -- marketplace icon, 60x60 Main Process, within the app://system.gaiamobile.org/index.html zone: - 61,456 B -- length=28946, copies=1 -- marketplace icon, 120x120 - 36,880 B -- length=17210, copies=1 -- marketplace icon, 90x90 - 20,496 B -- length=9114, copies=1 -- marketplace icon, 60x60 Homescreen process, within the system zone: - 184,368 B -- length=28946, copies=3 -- marketplace icon, 120x120 - 110,640 B -- length=17210, copies=3 -- marketplace icon, 90x90 - 61,488 B -- length=9114, copies=3 -- marketplace icon, 60x60 Homescreen process, with the app://verticalhome.gaiamobile.org/index.html#root zone: - 77,840 B -- length=38551, copies=1 -- games wallpaper (hooded thief), 320x480 - 61,456 B -- length=28946, copies=1 -- marketplace icon, 120x120 - 36,880 B -- length=17210, copies=1 -- marketplace icon, 90x90 - 20,496 B -- length=9114, copies=1 -- marketplace icon, 60x60 -------- Ones showing up as images (less important) -------- Smart Collections process: - 647,248 B (614,400 B uncompressed, 32768 B raw) -- games wallpaper - 36,944 B (20,480 B uncompressed, 16,384 B raw) -- "Games Games" dragon icon - 36,944 B (20,480 B uncompressed, 16,384 B raw) -- "Blackjack" icon - plus 6 more just like that - 32,848 B (20,480 B uncompressed, 12,288 B raw) -- "Sudoku Sam..." icon - plus 10 more just like that - 28,752 B (20,480 B uncompressed, 8192 B raw) - "Chess" icon - plus 4 more just like that Not much has changed since comment 0, except we have even more copies in the main process.
(In reply to Nicholas Nethercote [:njn] from comment #36) > -------- > Ones showing up as JS strings > -------- > > Main Process, within the system zone: > - 430,192 B -- length=28946, copies=7 -- marketplace icon, 120x120 > - 258,160 B -- length=17210, copies=7 -- marketplace icon, 90x90 > - 143,472 B -- length=9114, copies=7 -- marketplace icon, 60x60 I suppose you're using an engineering build? It looks like these may be coming from a dev app, which we should probably remove/update: https://github.com/mozilla-b2g/gaia/blob/master/dev_apps/marketplace.allizom.org/manifest.webapp (I'm guessing we should not see these in production)
> I suppose you're using an engineering build? I built it myself. Can I specify flags that make it more like a production build?
(In reply to Kevin Grandon :kgrandon from comment #37) > (In reply to Nicholas Nethercote [:njn] from comment #36) > I suppose you're using an engineering build? It looks like these may be > coming from a dev app, which we should probably remove/update: > https://github.com/mozilla-b2g/gaia/blob/master/dev_apps/marketplace.allizom. > org/manifest.webapp > > (I'm guessing we should not see these in production) That is the hosted version of the staging Marketplace. Technically it should be replaced with our current packaged version but we are testing a fully packaged version right now (just a couple bugs left) so it'll probably be easiest just to wait until that is finished and replace it then. Bug 897156 is tracking.
(In reply to Nicholas Nethercote [:njn] from comment #38) > I built it myself. Can I specify flags that make it more like a production > build? VARIANT=user should get you a build without all the dev and testing stuff.
I should clarify (although I'm not 100% on it myself): I believe this environment variable is used during the configuration step, so |VARIANT=user ./config.sh| should work, but it can't hurt adding it everywhere.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: