After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 431324 - Memory leaks with file loads?
Memory leaks with file loads?
Status: RESOLVED OBSOLETE
Product: GnuCash
Classification: Other
Component: Backend - XML
git-master
Other All
: Normal normal
: ---
Assigned To: Chris Lyttle
Chris Lyttle
Depends on:
Blocks:
 
 
Reported: 2007-04-19 12:04 UTC by Conrad Canterford
Modified: 2018-06-29 21:32 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Conrad Canterford 2007-04-19 12:04:33 UTC
Please describe the problem:
Gnucash appears not to be freeing memory from the previous file if you load a new file. If you start gnucash and it loads a data file, then you select File->Open and open another data file, it grabs memory for the new data file, but does not free the memory used for the first data file. This is especially noticable if you use large data files :-).

Steps to reproduce:
1. Start gnucash and load large data file
2. Check Gnucash's memory usage
3. Go File -> Open and open another large data file. 
4. Check memory usage again. Notice that its much larger.


Actual results:


Expected results:


Does this happen every time?
Reproducable. 4 out of 4 tests of this so far.

Other information:
Entered as a bug against the XML backend because I cannot test it to see if its actually at a higher level. Entered as a critical bug because Bugzilla suggests that a bug which makes the application leak large amounts of memory is a critical bug.
Comment 1 Christian Stimming 2007-04-20 08:54:29 UTC
Have you actually verified the memory usage by valgrind/memcheck? Or did you "only" look at the memory usage in "top" or similar? Before we even start to work on this issue, I'd like to have memory leaks verified by valgrind. In my experience, memory things often behave differently than one would think, and only an actual memory checker will tell you the truth.
Comment 2 Christian Stimming 2007-05-10 08:34:50 UTC
See http://lists.gnucash.org/pipermail/gnucash-devel/2007-May/020551.html ; valgrind was started with the following options (among others) --tool=memcheck --leak-check=full --trace-children=yes --error-limit=no --log-file=mycheck ; 

However, currently the only reported leak in there is in glib's g_get_filename_charsets() (this is glib2-2.12.4), but there does not seem to be a significant leak in gnucash itself. Perhaps the memcheck option --show-reachable=yes might show something interesting.
Comment 3 Daniel Harding 2007-12-19 14:07:38 UTC
While working on another issue, I noticed that Account objects didn't seem to get cleaned up when a book was closed.  In particular, xaccFreeAccount was not being called except for one SX-related account.  I suspected this might result in memory leakage, so I hacked up src\backend\file\test\test-load-xml2.c to load each file 10,000 times rather than just once.  When I ran the associated test executable, its memory usage (both Mem Usage and VM Size as seen with Windows Task Manager) did in fact steadily climb with each iteration of the loop.

As I am currently stuck on Windows and do not have access to tools like valgrind, I have not done any more to try to confirm that Account objects are being leaked or to see if anything else is being leaked.  However, it definitely does appear that memory is being left allocated when a book is closed.
Comment 4 Andreas Köhler 2008-05-13 22:53:22 UTC
Daniel, I think you are absolutely right.
I noticed the same while wondering why the test-lots test eats up that much memory and even after adding a missing qof_session_destroy() the test did not seem to free the memory allocated for the random engine objects.

CC'ing warlord as overlord :-)

So, who is supposed to free that data by design?  I would really like to see this one fixed.
Comment 5 Derek Atkins 2008-05-14 12:50:28 UTC
QOF is supposed to free the data when you end a session.
Comment 6 Tim M 2011-06-11 02:47:58 UTC
This is still occurring in 2.4.99 r20741.
Comment 7 John Ralls 2018-06-29 21:32:37 UTC
GnuCash bug tracking has moved to a new Bugzilla host. The new URL for this bug is https://bugs.gnucash.org/show_bug.cgi?id=431324. Please continue processing the bug there and please update any external references or bookmarks.