[lazarus] lazarus very gdi-resource hungry on windows 98

Vincent Snijders vslist at zonnet.nl
Sun Nov 30 16:32:29 EST 2003


Lazarus is uses very much gdi-resource (mostly pens) when I run it on
windows 98. I didn't test it on other win32 OSes.

To see, what I mean open de resource meter, which shows system, user and
GDI resources. If I open lazarus and move another window over the editor
it get very soon low on GDI-resources.

Can somebody else confirm this behaviour?

The moving of the other windows causes a lot of repaints of the editor
window. Some diagnostic tool showed pens are allocated, but not freed to
the OS. I have been trying to find out, why they are not returned to the
OS, but I couldn't find anything conclusive. I suspect it is because
DeleteObject is called, while the pen handle is still selected (in use)
on the canvas. MSDN says you must not call DeleteObject on gdi-objects
still selected in a device context. It also says it returns 0, when the
call fails, but I haven't seen it failing.

I couldn't find any code in canvas.inc or pen.inc, which deselects the
pen, before calling DeleteObject on the pen handle. 

I am on the right track or on a wild goose chase?


More information about the Lazarus mailing list