lots of GDI objects

  • Thread starter Thread starter codymanix
  • Start date Start date
C

codymanix

i'm experiencing a very weird problem here.
I've got a ListView, 4 columns and about 300 items. Nothing to worry about
there.

Which tool are you using to determine the number of GDI objects?
 
Hi,

i'm experiencing a very weird problem here.
I've got a ListView, 4 columns and about 300 items. Nothing to worry about
there.
Now when I scroll up and down repeatedly using the vertical scrollbar, I see
the number of GDI object grow rapidly. Now and then it drops again to about
60 which is reasonable.When this number reaches 10.000, all of a sudden, it
turns into 4.294.964.397 (more or less).
Running the garbage collector manually does not help anymore then.
I also noticed that when I run the garbage collector (manually) *before* the
number reaches 10.000 this problem does not occur.
What is going wrong here ? I'm not doing any custom drawing, I don't even
use another backcolor, font or whatever. Why does it allocate so many GDI
objects. If I wrote something like a ListView, I would cache some or all of
the pens and brushes, as in most cases all the rows have similar properties
(color, font, ...).

I must be missing something. Anybody a clue ?
Thanks in advance.
Greetings,
Bram.
 
I'm using the task manager. Is it that inaccurate ?


No I was just curious. But how can you be sure they are GDI objects?
 
Hi,

There's a GDI Objects column for every process in task manager, I suppose
they are what they are.
Never seen anything wrong when there was nothing wrong.
Over years I have found these numbers very accurate. Why shouldn't they not
be.
I suppose there might be a small bug in Task Manager, or in some kernel
function causing the number to go insane when it passes 10.000. Which
doesn't mean there is actually going something wrong in the GDI system.

But this doesn't explain why my listview is rapidly allocating so many gdi
objects while scrolling.

Cheears,

Bram
 
Hello,

I experienced the same problem but on a VB6 application, I guess that
internally no real sharing of resources is made, the thing is that the
applications crashes when reaches 10.000 GDI objects... That's why I like
most Visual C++...

Best regards,
Relu.
 
There's a known bug in the performance counter object for GDI handles (which
is used by taskman), once the max value (10000)is exceeded it returns a
bogus number.

Willy.
 
Back
Top