Repaint lag


I’m experiencing a quite weird behavior with juce repainting.

My test application uses normally about 10%-15% CPU when in full screen, but sometimes, it starts to lag and use all CPU (33%CPU, which is equivalent to 100%, as my system runs on 3 cores, PLUS the refresh rates obviously drops 2 or 3 fps, instead of the 20fps it should have.) This lag proceed for 3 to 5 seconds, then it’s back to normal.

The weird thing is the “sometimes” ! I mean, it happen whenever it feels like it ; no regular basis : sometimes even when I am doing nothing at all ! Switching to full screen seems to trigger the “bug”, though. (which is not too surprising, as resized() might generate quite a lot of caculation…) but

  • why doesn’t it always do it at resized() ? sometimes, size changes, and the app does nothing…
  • why does it take so long ? I mean that I can see from the display that the resized() is over, but the app is still lagging during a couple of seconds, so I wonder how my resized() could be at fault after it’s finished doing its job…

Any idea to fix the problem or to help understand better what caused it, will be welcome !
Thanks in advance for your help !


PS : Win Vista 32, using GIT tip, and the cpu’s mentionned above are actually debug, but similar behaviour happen in release, just more rarely.