Wilnath / asetroot

A lightweight animated wallpaper program
MIT License
34 stars 3 forks source link

Move image loading to avoid all memory usage #7

Closed victornor closed 3 years ago

victornor commented 3 years ago

I moved some imlib loading and image freeing into the pixmaps load loop. This reduces memory usage during load to almost nothing (compared to 15Gb+ when using a 1Gb folder before). This allows me to load 2Gb worth of images with my pc performance being completely unaffected.

Here's a demonstration: https://vimeo.com/582352185 CPU and memory usage is from recording and everything is smooth as butter when not recording

victornor commented 3 years ago

While testing a larger folder of frames, i've noticed that memory usage stays at near zero, until the folder size exceeds ~2.5Gb.

Wilnath commented 3 years ago

I must've assumed those imlib images were needed somewhere still, whoops.

Nice catch and thanks!

victornor commented 3 years ago

Any idea why memory usage still increases when the loaded files exceed 2.5Gb? I have a hard time seeing why size would change anything.

Wilnath commented 3 years ago

Any idea why memory usage still increases when the loaded files exceed 2.5Gb? I have a hard time seeing why size would change anything.

Sorry for not getting back to you earlier, was busy this week!

Do you mean memory usage during the loading phase or during the main loop?

If it's during loading it may be something to do with imlib, which I've no clue what to do about other than finding another way to load images (which seems like alot of effort for something not urgently needed)

If it's during the main loop I'm as puzzled as you are, would have to test on my own machines which is probably not going to happen in the near future.