Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
HUGE MEMORY LEAK pinpointed!
tiwag:
there is another memleak in codecompletion plugin (CCplugin)
loading and closing a big workspace (CB and all plugins projects e.g.),
with CCplugin enabled shows,
that the CCplugin leaks about 56MB of memory at each loading & closing cycle.
CB memory usage [MB]
with CCplugin
disabled enabled comment
37,7 34,7 initial startup of CB
39,9 150,5 load workspace
37,4 121,7 close ws
40,0 206,4 load workspace
37,8 183,2 close ws
40,1 262,1 load workspace
39,0 242,0 close ws
40,1 318,1 load workspace
38,9 299,4 close ws
40,3 373,8 load workspace
39,8 355,4 close ws
39,9 150,5 load workspace
40,5 429,7 close ws
tested with CB svn 4132, wx284 unicode, win-XP
memory usage measured with "Process Explorer" (sysinternals)
CCplugin set to parse local and global includes
brgds
MortenMacFly:
--- Quote from: tiwag on June 21, 2007, 05:42:13 pm ---there is another memleak in codecompletion plugin (CCplugin)
--- End quote ---
BT: I just remembered something I realised sometime back: A possible crash candidate in parser.cpp, lines 690-696 (and on some other places I don't recall, too):
--- Code: --- token = new Token();
if (!token->SerializeIn(f))
{
delete token;
token = 0;
break;
}
--- End code ---
What if token could not be created (and is NULL therefore)? Shouldn't the if-check better be:
--- Code: ---if (token && !token->SerializeIn(f))
--- End code ---
or something? (Need to implement an appropriate action anyway then...)
With regards, Morten.
Ps.: Should be go for a corporate bug-hunting for CC only?! ;-)
Der Meister:
--- Quote from: MortenMacFly on June 21, 2007, 06:09:09 pm ---
--- Quote from: tiwag on June 21, 2007, 05:42:13 pm ---there is another memleak in codecompletion plugin (CCplugin)
--- End quote ---
BT: I just remembered something I realised sometime back: A possible crash candidate in parser.cpp, lines 690-696 (and on some other places I don't recall, too):
--- Code: --- token = new Token();
if (!token->SerializeIn(f))
{
delete token;
token = 0;
break;
}
--- End code ---
What if token could not be created (and is NULL therefore)?
--- End quote ---
token can't be NULL (or better: 0) even if it could not be created because new throws an exception (std::bad_alloc if I remember correctly) if it failes to allocate enough memory. Another possible problem could arise inside the construktor of the class Token, but again the only way for aborting it is throwing an exception. That means in the line "if (!token->SerializeIn(f))" token always points to a valid Token instance.
mandrav:
--- Quote from: MortenMacFly on June 21, 2007, 06:09:09 pm ---
--- Quote from: tiwag on June 21, 2007, 05:42:13 pm ---there is another memleak in codecompletion plugin (CCplugin)
--- End quote ---
BT: I just remembered something I realised sometime back: A possible crash candidate in parser.cpp, lines 690-696 (and on some other places I don't recall, too):
--- Code: --- token = new Token();
if (!token->SerializeIn(f))
{
delete token;
token = 0;
break;
}
--- End code ---
What if token could not be created (and is NULL therefore)? Shouldn't the if-check better be:
--- Code: ---if (token && !token->SerializeIn(f))
--- End code ---
or something? (Need to implement an appropriate action anyway then...)
With regards, Morten.
Ps.: Should be go for a corporate bug-hunting for CC only?! ;-)
--- End quote ---
The serialization functions are not used anymore (for a long time now).
This means ReadFromCache() and WriteToCache() are not used so what you pointed at is effectively dead code.
Biplab:
Here is some "Meat" for "Memory-Leak-Hunters". ;)
I'm attaching the Valgrind log of Code::Blocks. I've run debug build of C::B (Rev 4145) with valgrind with the following options.
--- Code: ---valgrind --leak-check=full --show-reachable=yes
--- End code ---
BTW, I'm a newbie with valgrind. So I'm posting the log which I received. Please feel free to suggest improvements, if any.
Best Regards,
Biplab
[attachment deleted by admin]
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version