Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyprpaper uses too much memory #143

Open
DrShadow34 opened this issue Feb 29, 2024 · 13 comments
Open

Hyprpaper uses too much memory #143

DrShadow34 opened this issue Feb 29, 2024 · 13 comments

Comments

@DrShadow34
Copy link

According to the guide, preloading should take "This can result in around 8 - 20MB of mem usage", but for me hyprpaper uses around 1.8gb, what is kinda weird, especially after I looked into logs:

[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/octo.png, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/angel.jpg, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/dark.png, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/purple.png, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/pony.png, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/mercy.jpg, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/fox.jpg, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/colorfox.jpg, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/dash.png, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/catgirl.jpg, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/pink.png, Shared Memory usage: 132.7MB
[LOG] Total SM usage for all buffers: 1459.8MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/octo.png, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/angel.jpg, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/dark.png, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/purple.png, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/pony.png, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/mercy.jpg, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/fox.jpg, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/colorfox.jpg, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/dash.png, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/catgirl.jpg, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/pink.png, Shared Memory usage: 33.2MB
[LOG] Total SM usage for all buffers: 1824.8MB

As you can see, every picture reserving a lot of memory. Weird amount aside, why it's same number? Also, all pictures combined weight ~145mb. So I tried removing some pictures from preload, and that did nothing:

[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/dark.png, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/sacra/Pictures/Wallpapers/colorfox.jpg, Shared Memory usage: 132.7MB
[LOG] Total SM usage for all buffers: 265.4MB

Same size for each preload, lower amount simply because there not a lot to preload. Changing scaling will remove "Shared Memory usage: 132.7MB" row and there will be only "Shared Memory usage: 33.2MB" one, but memory allocation still same according to used memory.

Same result from hyprpaper-0.6.0-3 from arch repos and fresh version from git, currently: hyprpaper-git-0.6.0.r8.g09c40626-1

@vaxerski
Copy link
Member

vaxerski commented Feb 29, 2024

your pictures are compressed. Hyprpaper has to keep them in memory uncompressed. 33.2MB sounds like a 4K+ image.

It's not recommended to preload that many images.

@DrShadow34
Copy link
Author

DrShadow34 commented Feb 29, 2024

Yes, I'm using 4k resolution. Well, that make sense now, thank you. I guess that would be a good idea to put that into Readme.md, to clarify a bit about memory allocation, cause current version is a bit misleading for dumb people like me.

@vaxerski
Copy link
Member

feel free to make a MR to clarify parts that are unclear to you

@DrShadow34 DrShadow34 reopened this Feb 29, 2024
@DrShadow34
Copy link
Author

Okay, now I'm really curious. You said in MR that 4k image is 33.1MB uncompressed, then where 2gb coming from? 33.1 x 11 should be just ~364mb, right?

@vaxerski
Copy link
Member

correct. What are the resolutions of the images?

@DrShadow34
Copy link
Author

DrShadow34 commented Feb 29, 2024

Each preloaded image has own resolution, from 12288 × 8192 of the biggest one to 223 × 226 of the lowest one.
Upd. Okay, I was thinking for a second, that I'm going insane, so I converted all 11 images to 1080p png's and nothing changed, still 1824.8MB allocated. So I tried to change resolution of display to 1080p in hyprland.conf and now:
[LOG] Total SM usage for all buffers: 91.2MB, but according to htop "res" is still 1729M, what is just 47mb difference from 2160p. I don't understand :c

@vaxerski
Copy link
Member

vaxerski commented Mar 1, 2024

that's... odd. I don't understand either.

@DrShadow34
Copy link
Author

DrShadow34 commented Mar 1, 2024

It looks like no matter what, hyprpaper will just allocate same amount of memory per image (like there another 16k? screen), even if I preload 11 1x1 black png's it still will be 1.8GB (as staited before, 132.7mb per each loaded image). hyprctl monitor reporting normal 3840x2160 output and I have only one screen, so I have no idea why it doing that.

@krims0n32
Copy link

krims0n32 commented Jul 19, 2024

Seeing similar behaviour:

[LOG] Buffer created for target /home/js/.wallpapers/python-logo-4k-i6-3840x2160.jpg, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/js/.wallpapers/wp6248987.jpg, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/js/.wallpapers/wp5134478.jpg, Shared Memory usage: 33.2MB
[LOG] Buffer created for target /home/js/.wallpapers/lakeside-sunset-deer-minimal-art-landscape-scenic-panorama-3840x2160-4592.png, Shared Memory usage: 33.2MB
[LOG] Total SM usage for all buffers: 663.6MB

These wallpapers are no more than 250kb on disk.

@krims0n32
Copy link

Disabled fractional scaling because my wallpaper was really blurry (wallpapers are 4k as my native monitor resolution).

[LOG] Buffer created for target /home/js/.wallpapers/python-logo-4k-i6-3840x2160.jpg, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/js/.wallpapers/wp6248987.jpg, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/js/.wallpapers/wp5134478.jpg, Shared Memory usage: 132.7MB
[LOG] Buffer created for target /home/js/.wallpapers/lakeside-sunset-deer-minimal-art-landscape-scenic-panorama-3840x2160-4592.png, Shared Memory usage: 132.7MB
[LOG] Total SM usage for all buffers: 530.8MB

Still high but a little better.

@vaxerski
Copy link
Member

buffers have to be uncompressed. The fact your 4K wallpaper is a compressed-to-fuck jpeg doesn't matter.

@krims0n32
Copy link

I understand, but 530MB for 4 preloaded 3840x2160 wallpapers still seems excessive, no?

@vaxerski
Copy link
Member

yes, should be 130MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants