doodle-android icon indicating copy to clipboard operation
doodle-android copied to clipboard

High memory usage

Open patzly opened this issue 2 years ago • 4 comments

The memory usage of Doodle is very high compared to other apps, even Chrome uses much less memory. The graphics seem to be the main part, but also native code (Doodle does not use any native lib?).

How can the memory usage be reduced?

Screenshot 2022-02-18 175528

patzly avatar Feb 18 '22 16:02 patzly

how can the graphics take up so much memory when they are svg though?

coxackie avatar Mar 14 '22 09:03 coxackie

@coxackie the compact svgs paths are not the problem, the problem are only the bitmaps. Some wallpapers (eg all of the leaked Pixel 6 collection) contain beside the svg shapes a minimum of 1 object with a complex texture/photo, so this can't be stored as svg paths but has to be included as bitmaps. I have done this with base64 bitmap encoding which is a valid concept in svgs but this makes them really large, about 1000-2000kb for each (and then a separate light and dark version). Even the text editors cannot really display those long base64 lines with thousands of characters... The problem is that I can't compress them with jpg, because they need an alpha/transparency channel so it has to be lossless png. The only option is to scale them down, but I tried that and noticed that the lower quality when scaled up (eg on tablets) is very noticable.

patzly avatar Mar 15 '22 15:03 patzly

@patzly have you tried to monitor the memory for the svg walls? I am using pixel4 walls, and I see (from developer options) an average memory of ~240MB. This is not as high as ~385MB that you have, but I do not know whether the measurements are comparable. I would still say that ~240MB is quite a lot, but maybe there are bitmap components also in pixel4 walls?

coxackie avatar Mar 18 '22 07:03 coxackie

@coxackie No, there aren't any bitmaps in the Pixel 4 walls despite the third one with textures (codename Johanna). The weird thing is that the memory usage of the app is high (not as high as on the screenshot but higher than normal apps) without even setting the wallpaper... But it jumps to 380mb as soon as the wallpaper is being set, no matter which design is selected... I've read that graphic shaders (which probably render the bitmaps) are using much memory, but I haven't any clue why this also happens when only a Pixel 4 design (only very simple paths and simple fill colors) is running.

patzly avatar Mar 18 '22 18:03 patzly