Skip to content

Comments

Fix memory leaks in Jam Recorder#1073

Merged
softins merged 5 commits intojamulussoftware:masterfrom
softins:memory-leaks
Feb 22, 2021
Merged

Fix memory leaks in Jam Recorder#1073
softins merged 5 commits intojamulussoftware:masterfrom
softins:memory-leaks

Conversation

@softins
Copy link
Member

@softins softins commented Feb 20, 2021

Fixes #1019

EDIT: fixes leaks in the recorder, but there appear still to be others.

@softins softins added this to the Release 3.7.0 milestone Feb 20, 2021
@genesisproject2020
Copy link
Contributor

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.

@softins softins requested a review from pljones February 20, 2021 23:36
Copy link
Member

@hoffie hoffie left a 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)

{
if ( pJamRecorder != nullptr )
{
// We have a recorder running already. Terminate it.
Copy link
Collaborator

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.)

@softins softins requested a review from pljones February 21, 2021 16:29
@softins softins merged commit f95d2e9 into jamulussoftware:master Feb 22, 2021
@softins softins deleted the memory-leaks branch February 22, 2021 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Recorder Memory leak: Investigate valgrind output

4 participants