Author Topic: TODO list HUGE memory leak  (Read 7033 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
TODO list HUGE memory leak
« 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
« Last Edit: June 20, 2007, 02:55:50 am by rickg22 »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: TODO list HUGE memory leak
« Reply #1 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)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: TODO list HUGE memory leak
« Reply #2 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)
« Last Edit: June 20, 2007, 04:27:00 am by rickg22 »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: TODO list HUGE memory leak
« Reply #3 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

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: TODO list HUGE memory leak
« Reply #4 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.
« Last Edit: June 20, 2007, 07:02:30 am by Biplab »
Be a part of the solution, not a part of the problem.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: TODO list HUGE memory leak
« Reply #5 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.

Offline polygon7

  • Multiple posting newcomer
  • *
  • Posts: 104
    • Home site
Re: TODO list HUGE memory leak
« Reply #6 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, but I don't know any for Windows.
best regards,
p7
 Free open source UML modeling tool: ArgoUML

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: TODO list HUGE memory leak
« Reply #7 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. :)
Be a part of the solution, not a part of the problem.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: TODO list HUGE memory leak
« Reply #8 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.