Open Jacalz opened 1 year ago
Is the same increase shown in smaller or larger apps? Does it seem to be universally 2* or is it closer to 27MB higher for each app?
I launched the cmd/hello
executables and it seems as there is an initial 1.4x increase, or a 9MB increase in this case.
Clicking the button did not change much in terms of memory usage.
You could look using sudo pmaps FYNE_DEMO_PID
if the problem isn't just an increase in shared library usage which in that case doesn't really count for much as they will be shared. Measuring real memory usage of a process on Linux is fun :-)
As for the go memory allocated for sure, for fyne_demo and hello, a big culprit is vendor/github.com/benoitkugler/textlayout/fonts/glyphsnames/glyphs.go which allocate a lot of memory at startup as it use a map which is not read only/doesn't give a chance to the OS to do an optimistic load on it (10% of the allocated memory usage).
The second that I do not understand why, but we do allocate and keep allocated a single big *image.Alpha at all time (25% of the allocated memory usage). I would guess it is not necessary to keep it around, but not sure how we can make it better. I think that as we render things in opengl, it would be good to actually have the memory provided by the painter (to avoid unecessary copy and use of things like a single GL buffer)
With the last two improvements to font memory usage can this be closed @Jacalz?
I don't know. For some reason I am seeing more memory usage on develop now than on the release branch for v2.3.x. We are still over double to v2.2.4. Will have to check my workstation when I get home and see if I get similar results there. It seems unexpected given that I saw decreases with both of the PRs that you mention.
That is very strange. Maybe something slipped in that was not measured. Possibly the removing race condition from images, as that now caches the pixels on the image object?...
I am guessing @Jacalz is not using go pprof tools for benchmarking memory consumption, but using linux top or some equivalent tool. This might be also affected by kernel, cpu and general environment. So comparing between machine on those number is hard.
I was indeed not comparing using pprof but I also wasn't comparing between two machines. Will look into this more
This is marked as a blocker, does it need to hold back v2.4.0 at this stage?
Nah. I am still seeing the same amount of memory usage but it shouldn't need to hold back the release.
Checklist
Describe the bug
I noted during some testing that the memory usage seems to have roughly doubled between v2.2.4 and develop (to be v2.3.0). I initially launched
fyne_demo
and it had a 1.6x increase but switching the view resulted in it becoming a 2x increase:I observed a very similar 2x increase in Rymdport but at initial start without pressing anything.
How to reproduce
fyne_demo
on master branch and on develop branchScreenshots
See screenshots inline above ^
Example code
It does not really matter what code is being used. The demo reproduces the same problem.
Fyne version
4c67d93aa35be8646ba9c4354acb0492d5115f4d
Go compiler version
1.18.7
Operating system
Linux
Operating system version
Fedora 36
Additional Information
No response