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

[BUG?]: High memory consumption - spawn too many system threads for image/thumbnail decoding & leaking? #641

Open
l-const opened this issue Nov 4, 2024 · 4 comments

Comments

@l-const
Copy link
Contributor

l-const commented Nov 4, 2024

Cosmic-files version:

20f9292

Issue/Bug description:

Steps to reproduce:

Expected behavior:

Other notes:

using heaptrack: https://github.com/KDE/heaptrack

installed with :

dnf install heaptrack

executed:

heaptrack --pid ${pid of cosmic-files}

with initial on startup memory consumption of 48MB as seen from this:

screenshot-2024-11-04-21-17-30

reaching up to and excedding 300MB:

screenshot-2024-11-04-21-56-39

heaptrack overview:

screenshot-2024-11-04-21-29-27

screenshot-2024-11-04-21-44-31

it seems that no memory leak is happening but for the thumnail generation
we create through tokio too manu system threads by calling the clone3 system call

screenshot-2024-11-04-22-02-32

Here is the zipped .zst file that i exported:

heaptrack.cosmic-files.31272.zip

@l-const l-const changed the title [BUG?]: High memory consumption - memory leak? [BUG?]: High memory consumption - spawn too many system threads? Nov 4, 2024
@l-const l-const changed the title [BUG?]: High memory consumption - spawn too many system threads? [BUG?]: High memory consumption - spawn too many system threads for image/thumbnail decoding? Nov 4, 2024
@l-const
Copy link
Contributor Author

l-const commented Nov 5, 2024

Used top to find the number of threads from the process, there is a variable size of threads , starting with 31 and managed to get up to 43 but then again did go down to 31 again after inactivity, the worrying part is that i managed to reach 1.0 GB memory consumption:

executed:

top -H -p 6880

screenshot-2024-11-05-10-54-24
screenshot-2024-11-05-10-56-54

@l-const
Copy link
Contributor Author

l-const commented Nov 5, 2024

Update:

  1. reached 1.2 GB
  2. huge allocation from cosmic_text::shape_fallback and shapeline::layout_to_buffer
  3. actual leak in image::dynimage::DynamicImage::thumbnail::thumbnail_exact of 8.5 MB

screenshot-2024-11-05-12-28-47
screenshot-2024-11-05-12-35-53

heaptrack.cosmic-files.28551.zip

actually, cosmic_text seems to be leaking, reported 300MB :

screenshot-2024-11-05-12-53-25

heaptrack.cosmic-files.40307.zip

heaptrack stats:
	allocations:          	9778375
	leaked allocations:   	144634
	temporary allocations:	2224622
Heaptrack finished! Now run the following to investigate the data:

  heaptrack --analyze "/home/kostas/heaptrack.cosmic-files.40307.zst"

@l-const l-const changed the title [BUG?]: High memory consumption - spawn too many system threads for image/thumbnail decoding? [BUG?]: High memory consumption - spawn too many system threads for image/thumbnail decoding & leaking? Nov 5, 2024
@l-const
Copy link
Contributor Author

l-const commented Nov 6, 2024

screenshot-2024-11-06-22-50-52

screenshot-2024-11-06-23-05-21

@l-const
Copy link
Contributor Author

l-const commented Nov 6, 2024

I recorded a small video going from 50MB to 350MB:

memory-leak-cosmic-files.webm

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

1 participant