Memory leak with MuseSounds/MuseSampler
Steps to reproduce
- Open Task Manager (and watch MuseScore)
- Open big score with MuseSounds (MS4SOUNDS_Beethoven__Symphony_No._9__Op._125.zip)
- Playback, stop playback/start playback, start playback from beginning etc.
- Observe RAM amount (it's growing)
- Close score - RAM is not released as it should
- Open score again - it takes more RAM than before
Screenshots/Screen recordings
https://github.com/musescore/MuseScore/assets/90187801/06273838-c46f-4613-9563-3b41a3dcb705
MuseScore Version
4.4
MuseSampler 0.6.3 (latest version from MuseHub)
Regression
Doesn't occur in 4.2.1 (with the same musesampler version)
Operating system
Windows10
Additional context
No response
FYI, the second part of this issue, whereby closing and reopening a score doesn't free up memory when using MuseSounds, has had its own report here: https://github.com/musescore/MuseScore/issues/22721
A point that could be worth mentioning about the second part of the issue (that is, #22721): I can reproduce it in 4.2.1 (as well as in olders versions actually), whatever MuseSampler version I'm using. However, the rate of growth of memory is much lower than in 4.4 or 4.3, which can give the impression that it doesn't happen (and in that, it is similar to the scores using MS Basic instead of MuseSounds, that do also exhibit memory increase at lower rates).
I reopened that previously because it appeared again on Mac with the same memory loss after closing score. But now it looks much better, not so serious memory leaks after closing score. Results on Win (similar on Mac) on latest 4.4 master and musesampler 0.100.0.299:
- Measure memory - 177Mb
- Open MS4SOUNDS_Beethoven__Symphony_No._9__Op._125.zip and close it (after loading samples)
- Measure memory - 686Mb
- Open and close the same score
- Measure memory - 929Mb
- Open and close the same score
- Measure memory - 1047Mb
- Open and close the same score
- Measure memory - 1217Mb
- Open and close the same score
- Measure memory - 1309Mb
https://github.com/user-attachments/assets/7cfd4e14-60ed-4b08-ba0a-1b00df4dcd50
Memory leak after step 4 doesn't occur with MS Basic
I will log this (the comment above) separately since the memory leak is not so huge now