MuseScore icon indicating copy to clipboard operation
MuseScore copied to clipboard

Memory leak with MuseSounds/MuseSampler

Open DmitryArefiev opened this issue 1 year ago • 1 comments

Steps to reproduce

  1. Open Task Manager (and watch MuseScore)
  2. Open big score with MuseSounds (MS4SOUNDS_Beethoven__Symphony_No._9__Op._125.zip)
  3. Playback, stop playback/start playback, start playback from beginning etc.
  4. Observe RAM amount (it's growing)
  5. Close score - RAM is not released as it should
  6. 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

DmitryArefiev avatar Jun 06 '24 12:06 DmitryArefiev

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

metasekk avatar Jun 07 '24 07:06 metasekk

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:

  1. Measure memory - 177Mb
  2. Open MS4SOUNDS_Beethoven__Symphony_No._9__Op._125.zip and close it (after loading samples)
  3. Measure memory - 686Mb
  4. Open and close the same score
  5. Measure memory - 929Mb
  6. Open and close the same score
  7. Measure memory - 1047Mb
  8. Open and close the same score
  9. Measure memory - 1217Mb
  10. Open and close the same score
  11. 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

DmitryArefiev avatar Aug 07 '24 16:08 DmitryArefiev

I will log this (the comment above) separately since the memory leak is not so huge now

DmitryArefiev avatar Aug 07 '24 16:08 DmitryArefiev