Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

observation on memory consumption

(1/11) > >>

tiwag:
what i've done:

codecompletion plugin settings:
codecompletion: enabled,
parser: local includes and preprocessor definitions

i started C::B, memory settled at 13MB
loaded CodeBlocks.cbp project, memory settled at 36MB (peak is somewhat higher)
closed project, memory settled at 23MB, #note: + 10MB
loaded CodeBlocks.cbp project, memory settled at 37MB,
....

[edit] typos "memeory"

so we get a series of

13-36-23-37-24-38-26-40-27-42-28-43-44-32-47-33  [MB] memory consumption only by opening/closing the project

mean value (without first +10MB rise) :  delta-memory/project-load = (33 -23)MB / 7 = ~1.43MB leaked memory
and this is proportional to the amount of memory which is needed for all of the parsed symbols.

( hint: those with 2GB of ram, try it with local & global includes switched on ;-)  )

[attachment deleted by admin]

thomas:
Hmm... this measurement is inaccurate in one point.

Parser tokens are blockallocated objects, so that memory is never really freed. The application retains the memory block even if the objects are freed and reuses it when the next project is opened. So it appears to be leaking even if everything works correctly.

The same thing is true for ProjectFile objects, and ProjectBuildTargets, which are both block allocated, too.

rickg22:
OK Tiwag, try removing the blockallocated stuff and see if there's a leak. Is the leak still there? What happens if we also remove the codecompletion plugin?

thomas:
No need to remove the block allocator. There *is* a leak for sure.

I only said that the measurement is not accurate because of the block allocator, as it will always retain some memory. However, that memory does not grow and grow and grow indefinitely if you keep closing and re-opening a project. It always stays the same.

You may want to enable debug mode in the block allocator if you are interested whether it's Tokens what is leaked...

thomas:
Here is a more detailled explanation of why the block allocator can confuse you.

These are two recordings of the very same actions using the very same program and the same projects, but in different order:



1. Code::Blocks starts
2. Open wxSmith.cbp
3. Close wxSmith.cbp (here you get the idea "hey, what's happening, memory is leaked?")
4. Open CodeBlocks.cbp
5. Close CodeBlocks.cbp (again memory seems to be leaked)
6. Open wxSmith.cbp again (now it seems to consume no memory at all!)

Let's try the reverse order:

A. Code::Blocks starts
B. Open CodeBlocks.cbp
C. Close CodeBlocks.cbp
D. Open wxSmith.cbp

Again, opening and closing CodeBlocks.cbp seems to massively leak memory, but wxSmith.cbp does not seem to consume any memory at all.

This phenomenon is caused by the fact that the block allocator retains the memory and reuses it for the newly allocated objects. :)

Navigation

[0] Message Index

[#] Next page

Go to full version