musescore / MuseScore

MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
https://musescore.org
Other
12.15k stars 2.63k forks source link

Suspected memory leaks #22094

Open akberg opened 6 months ago

akberg commented 6 months ago

Issue type

Crash or freeze

Bug description

When working in MuseScore, the performance gradually deteriorates up to a point where it's completely useless or crashes (usually within 2-3 hours). Although I haven't had time to compile a dev version and attack it with Valgrind yet, I suspect some memory leaks or otherwise less than ideal resource management to be the root cause. Since surprisingly few users I have talked to can relate to the issue, I suspect it relates to some maybe lesser used features.

Issue #14693 points in the same direction, but seems to have been dismissed. I'm adding some more context, as this is a seriously workflow-killing issue.

Update after some further investigation: I've identified one very possible source of memory leaks in

Steps to reproduce

  1. Start a new score ~and work for some 2h,~ producing something like the attached sample score. 2. After that time, input lag has gradually increased to more than a second response time for any note input.
  2. Pick a note, use arrow keys to move the tone repeatedly up and down. Watch as memory consumption and input lag grows steadily without any meaningful data having been added to the score.
  3. Try some various notes, as the input lag doesn't seem to be apparent everywhere. In the sample score, some of the earliest bars seem less affected, while more recently added notes (here, in the winds and vocals) experience an extreme input lag after a very short time.
  4. Restart MuseScore to experience an improved response time.

Screenshots/Screen recordings

MuseScore Version

OS: Windows 10 Version 2009 or later, Arch.: x86_64, MuseScore version (64-bit): 4.2.1-240230937, revision: github-musescore-musescore-d757433

Regression

I don't know

Operating system

Windows 11, Fedora 39, Kubuntu 22.04

Additional context

Score (It's) Hairspray.zip

MarcSabatella commented 6 months ago

Are there specific steps that one can follow after loading the score in question that you have measured to show increased memory usage? The more specific you can be about how to reproduce the problem, the better the likelihood someone else will be able to reproduce the problem and thus investigate the cause.

akberg commented 6 months ago

I will try to investigate further myself when I get back to a machine that's powerful enough to build MS (and when I don't have a deadline for a score). But, in a second iteration of being slightly more attentive, I once again noticed drastic performance hits within an hour of working solely with note input, chord notation, and articulations.

In case a diff might help you pinpoint any suspecting behaviour, I'm also attaching a version of the same score after the above-mentioned session, and I'll do that a few more times as I pay extra attention while working on this score in particular.

Score (It's) Hairspray-1.zip

akberg commented 6 months ago

Added some more context; The key arrow "change note value" should be worth some closer examination.