GnuCash
Contact   Instructions
Bug 795384 - GnuCash 3 is tremendously memory hungry on macOs
Summary: GnuCash 3 is tremendously memory hungry on macOs
Status: NEW
Alias: None
Product: GnuCash
Classification: Unclassified
Component: General (show other bugs)
Version: 3.0
Hardware: Other Mac OS
: Normal minor
Target Milestone: future
Assignee: general
QA Contact: general
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-19 16:34 EDT by veigajose
Modified: 2018-12-30 15:33 EST (History)
6 users (show)

See Also:


Attachments

Description veigajose 2018-04-19 16:34:05 EDT
GnuCash 3 on macOs is memory hungry on macOs. Tremendously hungry, I must say. It uses 4-5 times more memory than the previous version 2.6.21.

I have made a comparison between versions 3.0 and 2.6.21 checking the memory use in (macOs build-in) Activity Monitor app. Gnucash 2.6.21 uses 360 Mb in my computer while GnuCash 3.0 uses 1.45 Gb.

I have noticed this memory abuse because my computer slowed down dramatically while GnuCash 3.0 was running.

I cannot provide any further information about the cause of this huge memory use just the symptom. Sorry about that.

I think that this is not just a question of optimization. It affects deeply the usability of the application and I consider that this issue should be correct if possible.


OS: macOS High Sierra 10.13.4
GnuCash: 3.0 Build ID: git 3.0+ (2018-04-01)
Comment 1 Adrien 2018-04-30 13:04:08 EDT
I'm not noticing any perceptible problems, but Activity Monitor does report significantly higher usage for me as well. 71MB vs. 251MB.

I would think since the entire book is loaded into memory, this might account for why our two figures are vastly different.

I'm also using 10.13.4 but tested with GnuCash 3.1 Build ID: 3.0-118-gd2ef5fd0f+ (2018-04-28)
Comment 2 veigajose 2018-04-30 16:55:17 EDT
Our data is big enough. Nine years of entries, a large chart of accounts, and lots of reports opened on start-up. You know... We are a SME...

However, our data does not cause any inconvenience in the past and, in my opinion, should not cause any trouble in future versions.

As your test has proven, the memory usage has increased from previous versions. A ratio of 5-6x times appears in your computer too.

Of course, since your memory usage is lower than ours, you do not notice anything. But the problem is there.

Thank for providing further evidence, Adrien.
Comment 3 Adrien 2018-07-09 23:36:00 EDT
While not as good as the 71MB from the 2.6 series, I now see memory usage is down to about 147MB from the earlier reported 251MB.

A 41% improvement! (though still slightly more than double 2.6.x)
Comment 4 John Ralls 2018-07-10 19:04:04 EDT
Are you both using the SQL backend (IIRC Adrien is using SQLite3)? 

Using the Leaks tool in Instruments (part of Xcode) I see that libdbi and libsqlite3 seem to be leaking profusely, so that memory usage is about 3x the data size compared to the same data exported to XML and then reloaded afresh.
Comment 5 Adrien 2018-07-10 19:45:59 EDT
I'm using SQLite3 now as of 3.2.

I just tested again, both XML and SQLite with only the CoA open and no other dialogs:

XML file size: 905KB
XML memory use: ≈101.6MB

SQLite file size: 7.2MB
SQLite memory use: ≈102.8MB

I see both slightly jump around by a few 100KB or so here and there even without moving the mouse or doing anything at all.

So both are much lighter than I reported yesterday and are nearly identical to each other in usage. (I think I had several tabs open)

I have 16GB to play with so I'm certainly not having any issues—just offering data.
Comment 6 Geert Janssens 2018-10-01 06:25:22 EDT
GnuCash 3.3 comes with fixes for several memory leaks. A large book that opened at about 1Gb of memory in gnucash 3.2 has now dropped back to about 300Mb and the memory increase while running is greatly reduced.

Please test with this version and report your findings here.
Comment 7 veigajose 2018-10-02 05:51:02 EDT
Yep. GnuCash 3.3 has lowered the memory use to 530 Mb from 1.45 Gb in version 3.0. A big improvement!

In our case, side by side, Gnucash 2.6.21 uses over 340 Mb while 3.3 needs 530, a ratio of 1.5 times more --instead of the 5-6X ratio when version 3 was launched.

Well done!

It is still 200 Mb more than previous version but we can live with this.

It is time to switch to version 3. Thanks.
Comment 8 veigajose 2018-10-04 04:33:46 EDT
Hi,

As soon as we have started to use GnuCash 3 in a daily basis the memory issue has re-emerged.

The memory abuse is, most probably, caused by the report engine, which I think has been changed from Guile-1.8 to Guile-2.2.

When the app is launching, it only generates one report tab in each window --the tab in focus. That means that if we have several report tabs in a window --which is the case--, it just generates the first one and the rest remain blank until they receive the focus.

As we switch from tab to tab, reports are generated and the memory use explodes. From initial 530 Mb memory use, it has roused up to 1.6 Gb. No real improvement indeed.

Tricky but not a real solution, I think. Not to mention the time wasted on waiting for a report generation --zero time delay in version 2; several not trivial seconds in version 3.

I think that Guile-2.2 has worsened GnuCash memory use and user experience without real benefit --at least, in our case.

Downgrading to GnuCash 2 again.
Comment 9 veigajose 2018-10-04 04:45:50 EDT
Well, actually, the guile engine has been upgraded from version 2.0 to 2.2.
Comment 10 veigajose 2018-10-04 05:05:55 EDT
(In reply to veigajose from comment #9)
> Well, actually, the guile engine has been upgraded from version 2.0 to 2.2.

I have made an experiment: replace guile 2.2 in GnuCash 3 with guile 2.0.

The app has run in a similar fashion: any crash on reporting, just report tab on focus was generated at first, and similar memory use. There is a slight differences in memory use: GnuCash 3 with guile 2.0 uses 1.2 Gb while guile 2.2 reserves 1.6 Gb.

My guess: perhaps memory use is related to how guile is used in GnuCash 3 rather than which version of guile is actually in use.
Comment 11 John Ralls 2018-10-04 10:31:10 EDT
The Guile-2.0->2.2 change is in 3.3, the 1.8->2.0 change in 2.6.4.

Aside from the 33% increase in memory footprint between Guile2.0 and 2.2 that you found, I think the most likely culprit is either Gtk3 or WebKit. While the WebKit version is unchanged (because I couldn't get the Javascript engine to talk to the WebKitGtkWebView on Mac), the drawing code in WebKit 2.4 will be different for Gtk2 and Gtk3.

How many reports do you typically have open? Do you notice any difference in memory footprint between different report types? What kind of Mac do you have?
Comment 12 veigajose 2018-10-05 05:12:43 EDT
Hi, John.

We regularly work with about 50-60 per session. Some are loaded at the beginning and some others are generated during each session.

However, for comparison purposes, it is the same number in both version 2 and 3. So, more or less, the memory use should be similar --not 5-6 times worse. Opening more reports just worsens the symptoms but the memory leaks are there regardless of the number of reports loaded.

I can really detail whether some kind of reports are behaving differently than others or not. I do not know how to check that kind of in-depth performance.

My systeme is currently macOs 10.13.6 (High Sierra)
I am comparing GnuCash 3.3+ (2018-09-29) versus GnuCash 2.6.21 (rev 868489b1c+ on 2018-04-10)

May I provide some additional information?
Comment 13 John Ralls 2018-10-05 09:59:27 EDT
Yes, what *kind* of Mac, not what version of MacOS. E.g., MacBook Pro Retina late 2016, iMac 21" late 2012, etc. I'm particularly interested in whether you have a Retina display.
Comment 14 veigajose 2018-10-05 10:31:20 EDT
I see... No Retina display. An iMac 27inch late 2013 (iMac14,2).

Note You need to log in before you can comment on or make changes to this bug.