Qalculate / qalculate-gtk

Qalculate! GTK+ UI
https://qalculate.github.io/
GNU General Public License v2.0
945 stars 68 forks source link

Possible Memory Leak(s) #395

Open Gitoffthelawn opened 2 years ago

Gitoffthelawn commented 2 years ago

Because Qalculate uses a fair amount of memory, I chose to use the 32-bit version. It nicely reduces memory consumption as compared to the 64-bit version.

But because of issue #365 (which I humorously named "the Dancing Calculator"), I decided to revisit the 64-bit version. On initial load, it occupies about 36% more RAM than the 32-bit version, but I still wanted to give it another try.

In the process of keeping on eye on Qalculate's RAM use, I noticed what appears to possibly be at least 1 memory leak (or perhaps lack of memory recovery would be a better term). I was able to quickly get Qalculate's RAM use to be over 97MB (tested with Qalculate v4.1.0 64-bit on Win7 64-bit).

STR:

  1. Open Qalculate v4.1.0
  2. Enable the history
  3. Perform some exciting math (depending on your personal definition of excitement!) ;)
  4. Expand the history area
  5. Close the history area
  6. Repeat steps 4 and 5 many times, and watch memory use slowly increase (note that memory use will decrease when the history area is closed each time, but not all the memory is released, resulting in gradual increase in memory use)

Overall, I noticed the more I used Qalculate, the more memory it consumed, even if I cleared the history after a while. Maybe a little love can be given to Qalculate's ability to recovery consumed memory? Thanks. Peace.

hanna-kn commented 2 years ago

This does not seem related to the history, but the result display. There was a memory leak each time it was updated. It should be fixed now.

Gitoffthelawn commented 2 years ago

This does not seem related to the history, but the result display. There was a memory leak each time it was updated. It should be fixed now.

Thanks Hanna. I had an inside hunch that might have been at least part of the situation because the size of the history didn't make a big difference... on the other hand, opening and closing the history doesn't actually change the results. Was performing this action causing the results to get displayed again each time?

Thanks for fixing it.

I have noticed that Qalculate's memory use goes up quite a bit as you use different functions and open different UI elements. Of course, it's to be expected to a certain degree, but the amount it goes up is quite a bit, even for small things. For example, just opening the About dialog box causes the memory use to increase more than it does in most applications.