Hi All,
I have been investigating bug report "suspected memory leak - ID: 3415254" and have gathered the following data (before my patience ran out). The tests reported here are with Git 55646df8 unless otherwise noted.
Geany left all day without any activity (with files open) did not increase in memory usage (and the same with 0.20, the reported version).
I then tried opening and closing geany/src/* repeatedly. The following table shows Geany memory usage (in Mb) when all files are closed and when all open and the difference. The last column shows that the first two times extra memory was used to tab through all the open files, but after that no more was used.
closed open delta tabbing 5.1 27.9 22.8 1.1 28.8 31.2 0.4 1.1 32.1 33.0 0.9 0.0 32.8 34.8 2.0 0.0 34.6 35.9 1.3 0.0 35.7 36.4 0.7 0.0 36.2 37.4 1.2 0.0 37.2 38.1 0.9 0.0 37.9 41.8 2.9 0.0 41.6 42.3 0.7 0.0 42.0 42.8 0.8 0.0 42.6 43.3 0.7 0.0 43.1 44.3 1.2 0.0 44.1 44.7 0.4 0.0 44.5 45.7 1.2 0.0
To me the key points are:
1. each time all files are closed only 200k is returned to the OS, but since the first open uses 22.8Mb but later ones less, Geany isn't leaking all of it, it is being held by the allocators.
2. ignoring the first open, the amount of extra memory used to open all the files varied from 0.4Mb to 2.9Mb. Average 1.1Mb or 5% of the initial 22.8Mb and standard deviation of 0.665Mb or 3% of the 22.8Mb.
3. Simple leaks are unlikely to cause the large deviation in the memory increase, each open of the same set of files would tend to leak the same amount. It is therefore likely that fragmentation effects cause the large deviation, but it may not be the whole cause of the increase.
Since Geany uses three different allocators, each of which has differing policies for holding onto memory, it is going to be difficult to separate real leaks from allocator effects.
For the bug reporter to have accumulated 300Mb of memory over "a few" days would have needed about 500 file opens per day, but maybe somewhat less as editing increases the memory usage.
So I don't think we have to worry excessively that we have a major leak, but keep an eye open for any possible problems.
Note that all my testing was with no plugins and only a couple of filetypes. There may be leaks and other effects in plugins and/or other Scintilla lexers. If the OP posts more information we may know more.
Cheers Lex