Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: rickg22 on June 20, 2007, 02:45:08 am

Title: TODO list HUGE memory leak
Post by: rickg22 on June 20, 2007, 02:45:08 am
Bad news guys! I just tested the todo list (i have no code completion enabled - in fact i deleted them from my cb dir) and everytime i click on a line, the memory usage for C::B doubles. I got it to consume up to 220MB in just two clicks!

Any idea what's happening with it?

SVN Rev 4110.

Update: Filed as bug #11421 (http://developer.berlios.de/bugs/?func=detailbug&bug_id=11421&group_id=5358)
Title: Re: TODO list HUGE memory leak
Post by: dmoore on June 20, 2007, 02:56:10 am
hmm... A few days back I noticed that when I disabled it that file load times increased significantly (Astyle and the, more understandably, the codecompletion plugin also slowed file loads)
Title: Re: TODO list HUGE memory leak
Post by: rickg22 on June 20, 2007, 04:17:23 am
I found out.

EVERY SINGLE TIME a file is opened, closed or even ACTIVATED, the parsing is re-done. And this is disregarding the current settings (per file, per project, open files). Since the log doesn't have a memory of todo items, it has to reparse before every refresh. Also, it does the scanning while opening the project, and not AFTER.

OK guys i'm tackling this one. I'll use a std map<wxString,vector<whatever >> to keep a "database" of todo items per file.

Revamp.. ON!!!  8)
Title: Re: TODO list HUGE memory leak
Post by: dmoore on June 20, 2007, 04:34:38 am
PS: compare the file load times between SciTE and codeblocks. Even with multi megabyte files SciTE opens virtually instantly. Only when you disable those three plugins I mentioned do you get close to the same speed in cb (the remaining sluggishness probably has something to do with line endings settings).

keep us posted
Title: Re: TODO list HUGE memory leak
Post by: Biplab on June 20, 2007, 05:11:29 am
Rick,

I'm also working on similar problem since past week. :) I've added couple of SDK functions to detect Project/Workspace Loading/Closing state.

The idea is to stop this unnecessary parsing during project/workspace load/close or during app shutdown. Though I haven't committed it yet.
Title: Re: TODO list HUGE memory leak
Post by: rickg22 on June 20, 2007, 08:49:56 am
I did something similar to the plugin. It works on startup / shutdown, but when loading/unloading project, it's still blind.

However I did manage to speed it up significantly now, added some flags for reentrancy, file modification checks, and memory usage only goes to 33MB.

Unfortunately, the memory leak is STILL present. Everytime i hit "Refresh list", memory consumption goes up by 20 MB. I need memory debugging tools or something.

I'll commit tomorrow anyway, it seems the plugin's 100% usable now.
Title: Re: TODO list HUGE memory leak
Post by: polygon7 on June 20, 2007, 09:57:35 am
Unfortunately, the memory leak is STILL present. Everytime i hit "Refresh list", memory consumption goes up by 20 MB. I need memory debugging tools or something.
Hi,
for Linux the best memory debuger is Valgrind (http://valgrind.org/), but I don't know any for Windows.
Title: Re: TODO list HUGE memory leak
Post by: Biplab on June 20, 2007, 10:15:26 am
I did something similar to the plugin. It works on startup / shutdown, but when loading/unloading project, it's still blind.

I've added couple of SDK functions to detect Project/Workspace Loading/Closing state. It's in rev 4114. :)
Title: Re: TODO list HUGE memory leak
Post by: rickg22 on June 22, 2007, 03:32:08 pm
Biplab: Thanks! Also, I improved on them and there's a function for all plugins (I think you've seen it in the SVN log). It's ProjectManager::IsBusy(). It also checks the isShuttingDown to be safe.