-
Notifications
You must be signed in to change notification settings - Fork 225
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
Memory leak when using Rpc server #2614
Comments
Thanks for the report. I vaguely remember that other init-once stuff was not properly cleaned up on exit in the past, but I'm not totally sure and don't remember if it might have been fixed meanwhile. I think it makes sense to fix it in order to have a clean output when chasing more relevant leaks. Are you planning to submit a PR for this issue? If so, that would be great and I'll assign it to you. It will hopefully be a non-controversial PR which can be merged quickly. (I've edited the description to point to a master commit as 3.8.2 (final) can't have been affected as it didn't have the RPC code yet) |
@pgScorpio Hello, thanks for the report on memory leaking issue. I'm the original author of the JSON-RPC code. IMO this issue may not be a high impact one because the RPC server is initialized once and used throughout the lifetime of the process. Still I agree that it is a memory leak nonetheless and it is better to have a cleaner output from memory profiler. Most of my programming background is in a garbage-collected language and so I forgot how to properly manage memory in C++ already 😂 On my first implementation, I allocated an RPC server directly on the stack, but after code reviews, it has been changed to use C++ smart pointers, and subsequently to use just the |
Yes, there is still a lot more. i.e. ASIOSDK also has a big memory leak, and we can't change that, but that should be solved with the new Sound implementation (not using those ASIOSDK classes/functions.)
Yes, I just did a pull request, See #2618 |
Unfortunately C++ has no garbage collections and a memory leak is easily created....
"using C++ smart pointers" ?? for ServerRpc and ClientRpc there wheren't pointers at all, just new...
Well deallocating objects when the went out of scope can only be done via a class where the destructor deallocates (And a smart pointer is such a class.) The problem here is that they are created conditionally and so do not have a specific scope... |
Moved to 3.9.1 |
Moving to 3.10.0. |
Moving to Triage and removing milestone. |
Closing as no activity in two years. |
Describe the bug
CServerRpc and CClientRpc/CServerRpc are created with "new" in main.cpp, but are never deleted.
To Reproduce
Run Jamulus with and without valid --jsonrpcport and --jsonrpcsecretfile parameters.
Use Visual studio's memory usage diagnostic tool to check the difference in memory usage at exit.
Expected behavior
Cleanup on exit.
Screenshots
Operating system
n.a.
Version of Jamulus
master @ 953f2b8
Additional context
The text was updated successfully, but these errors were encountered: