Author Topic: C::B using huge amounts of memory  (Read 3644 times)

Offline Kazade

  • Multiple posting newcomer
  • *
  • Posts: 73
C::B using huge amounts of memory
« on: August 13, 2010, 01:15:45 pm »
I'm having some real problems with CodeBlocks on a reasonably large project (~20,000 lines). I'm using the latest build from Pasgui's Ubuntu repository on Ubuntu 10.10. The problem I'm having is that everything will work fine for an hour or so, and then the hard disc starts churning and the PC becomes pretty unresponsive (although not totally). When I run "top" it shows that C::B is using 70-80% of my memory (around 2.7G) and the CPU is using around ~60.0% I think the general slow down is due to the disk swapping when I run out of memory.

This seems to be related to the code completion plugin. I've just disabled it and restarted C::B and now memory usage is a far more respectable 465M and CPU ~3%.

Has anyone else experienced a problem like this?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: C::B using huge amounts of memory
« Reply #1 on: August 13, 2010, 01:56:49 pm »
Looks like you've written some code that breaks the parser in the code completion plugin.
Can you try to produce a minimal project that reproduces the problems?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Kazade

  • Multiple posting newcomer
  • *
  • Posts: 73
Re: C::B using huge amounts of memory
« Reply #2 on: August 13, 2010, 04:05:03 pm »
Um, I would... but I'm not even sure where to begin, how can I tell where the problem is?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: C::B using huge amounts of memory
« Reply #3 on: December 09, 2010, 02:59:37 am »
codecompletion plugin use a TokensTree structure to store all the Tokens( the same term is the Tag). so if your project is large, the TokensTree may explode.

But I suspect the problem is located in some macro expansion. You can try to disable the "macro expansion" option in the CC's option dialog and see it happens again.  :D

BTW: try use a more recent codeblocks, like nightly build version.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.