Skip to content

Commit

Permalink
Fix memory leak that the rpmalloc assert warns of (LMMS#5776) (Fixes L…
Browse files Browse the repository at this point in the history
…MMS#5733)

Hack to take care of the assertion sent by the rpmalloc memory manager. Creates a static "free" function for NotePlayHandleManager and then shoves it right before the program ends.

Co-authored-by: Pause for Affliction <[email protected]>
  • Loading branch information
sziegler103 and sziegler103 authored Nov 10, 2020
1 parent fbf039d commit c01ba58
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/NotePlayHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ class NotePlayHandleManager
NotePlayHandle::Origin origin = NotePlayHandle::OriginPattern );
static void release( NotePlayHandle * nph );
static void extend( int i );
static void free();

private:
static NotePlayHandle ** s_available;
Expand Down
5 changes: 5 additions & 0 deletions src/core/NotePlayHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,3 +623,8 @@ void NotePlayHandleManager::extend( int c )
++n;
}
}

void NotePlayHandleManager::free()
{
MM_FREE(s_available);
}
3 changes: 3 additions & 0 deletions src/core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,5 +1009,8 @@ int main( int argc, char * * argv )
}
#endif


NotePlayHandleManager::free();

return ret;
}

0 comments on commit c01ba58

Please sign in to comment.