nate-xyz / resonance

Intuitive GTK4/LibAdwaita music player
https://beta.flathub.org/apps/io.github.nate_xyz.Resonance
GNU General Public License v3.0
367 stars 21 forks source link

Resonance 0.1.2 flatpak takes too much time to open after music library build and consume a huge amount of ram #32

Open Alexios13 opened 1 year ago

Alexios13 commented 1 year ago

The application takes too long to open as for some reason it consumes too much ram. In my case resonance was using more and more ram until it reached 10.6Gb and then it opened. The version of the application is 0.1.2 flatpak, OS: Nobara 37, intel i7 8750h, 16gb ram. I don't know what other information I might need to provide or how to find this information but let me know if you want more.

Στιγμιότυπο οθόνης από 2023-04-08 16-59-53

nate-xyz commented 1 year ago

Is this abnormally large usage of memory only on startup? Is also too high during the import process? Is it normal during regular usage of the application after import? How large is your music library?

Arcitec commented 1 year ago

How large is your library?

My library is only 20 tracks. It uses 64.2 MB RAM for me..

Alexios13 commented 1 year ago

My library has 14104 files with a total size of 54.8Gb. This large consumption happens every time I open the application. After it opens, the consumption drops to about 9Gb of ram. When I opened the app for the first time I didn't notice how much ram it consumed but it had crashed once and on the second try it loaded my library and opened. The lollypop app consumes about 400mb for the same library.

nate-xyz commented 1 year ago

This is just speculation without looking into it yet but this could possibly be related to gdk pixbuf memory usage, if you have a large library and your embedded tag art is super high in resolution I could see that using a huge amount of memory. If it is that, I could set a limit on image size when importing so images stored in the database are compressed.

Alexios13 commented 1 year ago

It is true that my library is large and the embedded tag art is super high in resolution. Is it possible that it doesn't load on startup but when you choose to view the page of an artist or album?

nate-xyz commented 1 year ago

Could you use sqlitebrowser or some similar application to look at the database? The db file should be in (your home folder) / .var/app/io.github.nate_xyz.Resonance/data/io.github.nate_xyz.Resonance/.

Once you open the file, take a look at the Cover_Art table. If you're using sqlitebrowser you should be able to see the image size on the right panel.

nate-xyz commented 1 year ago

Is it possible that it doesn't load on startup but when you choose to view the page of an artist or album?

Are you suggesting that it shouldn't load on startup or asking whether it does or not? Right now the application loads all images into memory at startup, which is definitely not optimal in your case. I could definitely implement lazy loading for images + maybe compressing super high resolution image art.

Alexios13 commented 1 year ago

Is it possible that it doesn't load on startup but when you choose to view the page of an artist or album?

Are you suggesting that it shouldn't load on startup or asking whether it does or not? Right now the application loads all images into memory at startup, which is definitely not optimal in your case. I could definitely implement lazy loading for images + maybe compressing super high resolution image art.

Yes, that's what I'm describing.

Could you use sqlitebrowser or some similar application to look at the database? The db file should be in (your home folder) / .var/app/io.github.nate_xyz.Resonance/data/io.github.nate_xyz.Resonance/.

Once you open the file, take a look at the Cover_Art table. If you're using sqlitebrowser you should be able to see the image size on the right panel.

I installed sqlitebrowser and found the Cover_Art table but I don't understand what I should see and report as there is no right panel.

nate-xyz commented 1 year ago

I installed sqlitebrowser and found the Cover_Art table but I don't understand what I should see and report as there is no right panel.

My fault I should've been more specific, you have to:

1) right click the Cover_Art table and click "Browse Table" 2) click on the BLOB values in the data column to see the image preview

Alexios13 commented 1 year ago

Ok I did it. Most images are 1200x1200 pixels

nate-xyz commented 1 year ago

Ok cool thanks, what was the general file size if u don't mind?

Alexios13 commented 1 year ago

Sorry I should have mentioned it. About 300kib per image on average.

nate-xyz commented 1 year ago

Weird, that's not too crazy, a lot of mine are that size or bigger. How many rows are in the Cover_Art table?

Alexios13 commented 1 year ago

How many rows are in the Cover_Art table?

1254 rows Στιγμιότυπο οθόνης από 2023-04-08 19-32-05

nate-xyz commented 1 year ago

Are there any duplicates?

Alexios13 commented 1 year ago

No, it's all different.

nate-xyz commented 1 year ago

Ok, unless something else is a huge memory hog this is probably the culprit, and I'll need to implement lazy loading every pixbuf

SoiledBrush commented 1 year ago

I also have same problem Screenshot from 2023-04-08 23-00-30 nearly 10k song taking 250gb.

random-name01 commented 1 year ago

For me it even crashes when indexing my music folder (>14.000 songs with embedded artwork). I’m assuming this is the same underlying issue, hence why I didn’t open a new thread.

legacychimera247 commented 1 year ago

having a quick test, i have about 3.7 gb for a 300 gb music folder, same folder has like 260 mb with tauon music box, so improvements are very much welcome :P :)

edit: had to reimport the music folder today, now it loaded all (more or less) of the artists images and it's up to 4.2 gb...

AshtakaOOf commented 1 year ago

I have 1800 tracks and I'm having the same issue as Alexios13, same behavior and same ram usage.