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

Possible memory leak #344

Open
fulalas opened this issue Feb 16, 2025 · 8 comments
Open

Possible memory leak #344

fulalas opened this issue Feb 16, 2025 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@fulalas
Copy link

fulalas commented Feb 16, 2025

Memory consumption goes from 90 MB to 187 MB after some time (hours) using it. Is there a reason for that?

Tested nchat 5.5.13 on Porteux 1.9

@fulalas fulalas added the bug Something isn't working label Feb 16, 2025
@d99kris
Copy link
Owner

d99kris commented Feb 16, 2025

Hi @fulalas - will look into this, you are using WhatsApp, right?

@d99kris
Copy link
Owner

d99kris commented Feb 16, 2025

There was indeed a couple of memory leaks (for whatsapp protocol), and the above commit should address them.

Thanks for reporting this! 👍

@fulalas
Copy link
Author

fulalas commented Feb 16, 2025

Thanks a lot!

It definitely helped, but there's still some memory leak: after a few hours the memory consumption went from 90 MB to 145 MB.

Maybe you could use valgrind, no?

@fulalas
Copy link
Author

fulalas commented Feb 16, 2025

I did it, and here's the initial result:

==489== LEAK SUMMARY:
==489==    definitely lost: 380 bytes in 15 blocks
==489==    indirectly lost: 0 bytes in 0 blocks
==489==      possibly lost: 155,122 bytes in 47 blocks
==489==    still reachable: 461,072 bytes in 818 blocks
==489==         suppressed: 240 bytes in 1 blocks

@d99kris
Copy link
Owner

d99kris commented Feb 16, 2025

It definitely helped, but there's still some memory leak: after a few hours the memory consumption went from 90 MB to 145 MB.

Ok thanks for checking. I admittedly only tested for ~1 hour and saw it was stable here.

Maybe you could use valgrind, no?

I tried with valgrind but it didn't report any "non-constant" leaks, so I used a tool of my own heapusage and fixed the leaks it detected.

I have yet to run a longer (and more active) session though.

I'll re-open the issue until it's completely fixed.

Btw, you are only using WhatsApp right, one account/profile?

@d99kris d99kris reopened this Feb 16, 2025
@fulalas
Copy link
Author

fulalas commented Feb 16, 2025

Btw, you are only using WhatsApp right, one account/profile?

Sorry, I forgot to answer that. Yes, I am using both WhatsApp and Telegram. Only one account per protocol, yes.

When I send a file (a simple image), even to myself, I can see the memory usage increasing. It happens in both Telegram and WhatsApp protocols. I did this a couple of times in both, and memory consumption jumped from 90 MB to 127 MB.

@d99kris
Copy link
Owner

d99kris commented Feb 16, 2025

Thanks, that is useful info 👍 Will continue look into it.

@fulalas
Copy link
Author

fulalas commented Feb 16, 2025

Oh, 3 more things that I'm not sure if can be useful to inform:

  1. I'm compiling with these build flags: "-O3 -march=x86-64-v2 -mtune=generic -DNDEBUG".

  2. I'm doing this to force the build to use golang: sed -i 's|go build|go build -buildvcs=false|g' lib/wmchat/go/CMakeLists.txt

  3. I'm compiling using llvm/clang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants