-
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
Fix memory leaks in Jam Recorder #1073
Conversation
I've compiled the updated code and put it live on Swedish Open Jam 1 and 2. Now just waiting to see what's happens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I can confirm that the following leaks no longer appear in valgrind after this PR. I therefore suggest merging this and continue leak hunting afterwards. :)
==129778== by 0x1AD536: recorder::CJamClient::CJamClient(long long, int, QString, CHostAddress, QDir) (in /home/christian/Projects/jamulus/Jamulus)
==129778== by 0x1AEAB7: recorder::CJamSession::Frame(int, QString, CHostAddress, int, CVector<short>, int) (in /home/christian/Projects/jamulus/Jamulus)
==129778== by 0x1B18C6: recorder::CJamRecorder::OnFrame(int, QString, CHostAddress, int, CVector<short>) (in /home/christian/Projects/jamulus/Jamulus)
==129778== 438 (88 direct, 350 indirect) bytes in 1 blocks are definitely lost in loss record 120 of 165
==129778== at 0x483ADEF: operator new(unsigned long) (vg_replace_malloc.c:342)
==129778== by 0x5AF54E5: QObject::QObject(QObject*) (in /usr/lib/libQt5Core.so.5.15.2)
==129778== by 0x1ADF21: recorder::CJamSession::DisconnectClient(int) (in /home/christian/Projects/jamulus/Jamulus)
==129778== by 0x1AE1A8: recorder::CJamRecorder::OnDisconnected(int) (in /home/christian/Projects/jamulus/Jamulus)
==129778== 876 (112 direct, 764 indirect) bytes in 2 blocks are definitely lost in loss record 129 of 165
==129778== at 0x483ADEF: operator new(unsigned long) (vg_replace_malloc.c:342)
==129778== by 0x1ADF14: recorder::CJamSession::DisconnectClient(int) (in /home/christian/Projects/jamulus/Jamulus)
==129778== by 0x1AE1A8: recorder::CJamRecorder::OnDisconnected(int) (in /home/christian/Projects/jamulus/Jamulus)
==129778== by 0x5AEC581: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.15.2)
==129778== 1,744 (352 direct, 1,392 indirect) bytes in 4 blocks are definitely lost in loss record 146 of 165
==129778== at 0x483ADEF: operator new(unsigned long) (vg_replace_malloc.c:342)
==129778== by 0x5AF54E5: QObject::QObject(QObject*) (in /usr/lib/libQt5Core.so.5.15.2)
==129778== by 0x1ADF21: recorder::CJamSession::DisconnectClient(int) (in /home/christian/Projects/jamulus/Jamulus)
==129778== by 0x1AE1A8: recorder::CJamRecorder::OnDisconnected(int) (in /home/christian/Projects/jamulus/Jamulus)
src/recorder/jamcontroller.cpp
Outdated
} | ||
|
||
if ( !newRecordingDir.isEmpty() ) | ||
{ | ||
if ( pJamRecorder != nullptr ) | ||
{ | ||
// We have a recorder running already. Terminate it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so I don't get so nervous reading this, can it be a clearer comment, please:
// We have a reference to a CJamRecorder instance that should now have finished. Clean up the instance.
(pJamRecorder->moveToThread ( pthJamRecorder );
puts pJamRecorder
into the thread and the pthJamRecorder ->wait()
above - if we had one - waited for it to finish.)
Fixes #1019
EDIT: fixes leaks in the recorder, but there appear still to be others.