GDI leak

Think you've found a bug? Post a description here.

Moderator: Serin

mdj
Moderator
Posts: 656
Joined: Mon Aug 18, 2003 4:00 am
Location: Denmark
Contact:

GDI leak

Post by mdj » Thu Sep 02, 2004 5:44 am

Using the new 2.2 release version (I haven't checked if the error was in earlier version too), enter the Server Manager, the User Manager or IP Manager, close it again, and note how the number of GDI objects displayed in the task manager does NOT fall back to the original value. In fact, 1 GDI object leaks for every time you enter one of the manager dialogs.
Morten Due Jørgensen
http://www.mdjnet.dk

User avatar
Serin
Site Administrator
Posts: 1785
Joined: Sat Jan 01, 2005 6:57 pm
Location: United States
Contact:

Post by Serin » Thu Sep 02, 2004 2:32 pm

Thanks,

I will look into it.

mdj
Moderator
Posts: 656
Joined: Mon Aug 18, 2003 4:00 am
Location: Denmark
Contact:

Post by mdj » Fri Dec 03, 2004 5:18 am

Any news on this one? The problem is still there in 2.22.
Morten Due Jørgensen
http://www.mdjnet.dk

User avatar
Serin
Site Administrator
Posts: 1785
Joined: Sat Jan 01, 2005 6:57 pm
Location: United States
Contact:

Post by Serin » Mon Dec 06, 2004 5:26 pm

Sorry mdj, I haven't looked into it recently. I will bump it back up to a higher priority. I seem to remember not seeing the resource leak you reported, but I am not sitting at a dev box right now so I can't test it.

BTW, what OS are you running?

mdj
Moderator
Posts: 656
Joined: Mon Aug 18, 2003 4:00 am
Location: Denmark
Contact:

Post by mdj » Tue Dec 07, 2004 7:00 am

I am running W2K (server), sp4. Don't give it too high a priority though, it is not *that* critical, I just wondered where it was hiding in the bug-files these days.
Morten Due Jørgensen
http://www.mdjnet.dk

mdj
Moderator
Posts: 656
Joined: Mon Aug 18, 2003 4:00 am
Location: Denmark
Contact:

Post by mdj » Fri Jan 27, 2006 10:35 am

Well, it is about time, I ask to this one again. :-) Any news on finding the escaping GDI object? I am now running Cerberus 2.32 on a W2K SP4 (workstation, english), and I still see the bug.
Morten Due Jørgensen
http://www.mdjnet.dk

User avatar
Serin
Site Administrator
Posts: 1785
Joined: Sat Jan 01, 2005 6:57 pm
Location: United States
Contact:

Post by Serin » Fri Jan 27, 2006 1:52 pm

Honestly, I don't see a GDI leak under XP. Nor do I see one when I run it through Purify. Very odd...

mdj
Moderator
Posts: 656
Joined: Mon Aug 18, 2003 4:00 am
Location: Denmark
Contact:

Post by mdj » Mon Feb 06, 2006 6:48 am

Just tested on my XP, upgraded from 2.2B, and this time I tried not to run as a service. I still see the leak... So, 2 machines, XP and W2K, service and non-service, 2.32, leak in all cases. Well, but if I am the only one in the world having this problem, I guess, I will just have to live with it! :-)
Morten Due Jørgensen
http://www.mdjnet.dk

Tornado
Senior User
Posts: 234
Joined: Tue Jun 08, 2004 9:39 am
Location: Australia

Post by Tornado » Mon Feb 06, 2006 2:55 pm

Can you maybe make a step by step tutorial with plenty of screendumps to show exactly what you are seeing? If Serin replicates your actions, then hopefully he can track it down and resolve it.

mdj
Moderator
Posts: 656
Joined: Mon Aug 18, 2003 4:00 am
Location: Denmark
Contact:

Post by mdj » Thu Feb 09, 2006 5:32 am

Sure! I am pretty sure, Serin already knows how to watch for this problem, but maybe others can look for it too. I have installed a fresh Cerberus 2.32 on my english W2Ksp4, (logged in as administrator, no FTP users configured, default installation options all the way, no WAN IP detect), started it (not as service, but I see the problem under _all_ circumstances), and as you can see on the picture, top line, it starts out with 84 GDI objects. The dump is taken from the Task Manager, be sure to tick View/Select Columns.../GDI Objects, or that column will not be visible.

Then I click on the "Configure the Server Options" button in cerberus, and the count goes up to 110 (not dumped), which is OK, we are doing work. When I cancel the dialog, it drops to 91 (second line), which is also OK, an initial consumption is fine, we have been into the dialog, and some stuff is saved, ready for reuse. Then I click the Server Options button again, and the count goes to 113. Now we are beginning to see the problem. Why would we need 113 the second time, when 110 was enough the first time? Still, no problem, there might be a good explanation, but then I cancel the dialog again, the count drops to 92, third line, and THEN the alarm goes off. It should drop to 91, as the initial consumption is already done. In fact, if I continue to enter and cancel the dialog (or one of the other two configuration dialogs), the count will go to 93, 94, 95... leaking an object each time.

Actually, the memory consumption goes up slowly with it, but that might just be the same error, or other effects, memory consumption is very difficult to predict. At least at this point, I will not claim to see a memory leak too, until the GDI leak is gone.

GDI objects is a limited resource, and sooner or later it will halt the machine, or at least the GUI. However, since people - myself including - rarely enters these dialogs, once the setup phase is done and the machines are restarted "regularly", this has not been a problem for any one so far - myself including. I just spotted it by coincidense, since my server is rather rarely restarted (has been running for almost 200 days at the time of writing), so I regularly monitor these counters.

Anyone else seeing the problem?

Image
Last edited by mdj on Thu Mar 23, 2006 7:03 am, edited 1 time in total.
Morten Due Jørgensen
http://www.mdjnet.dk

Tornado
Senior User
Posts: 234
Joined: Tue Jun 08, 2004 9:39 am
Location: Australia

Post by Tornado » Thu Feb 09, 2006 9:44 am

Yes I see what you mean. Its a great find. However, if Serin can't find the problem in his code, then I wonder if there is a GDI leak through Microsoft's Win32 API set.

mdj
Moderator
Posts: 656
Joined: Mon Aug 18, 2003 4:00 am
Location: Denmark
Contact:

Post by mdj » Fri Feb 10, 2006 4:40 am

It is not unlikely at all, that the error is in MS's code, however, I see the problem on both W2K and XP, and Serin doesn't see it at all (I don't know if he tried both OS'es), so I am leaning more towards some setup in Cerberus making the difference, and the error is thus inside Cerberus. After all, I don't see other applications leak this way (except for explorer.exe, at least in W2K, which is rather leaky).
Morten Due Jørgensen
http://www.mdjnet.dk

Tornado
Senior User
Posts: 234
Joined: Tue Jun 08, 2004 9:39 am
Location: Australia

Post by Tornado » Sat Feb 11, 2006 4:03 pm

I have yet to look closer, but on initial inspection, I may have found the GDI leak to be within a font resource. Goto http://msdn.microsoft.com/msdnmag/issue ... fault.aspx and "Download the code for this article: GDILeaks.exe (13,279KB) ". It contains a nice tool called GDILeak, and it reveals a font leakage on all windows after opening/closing them.

Like i said, I'm still needing to look at these programs more to determine correct usage.

mdj
Moderator
Posts: 656
Joined: Mon Aug 18, 2003 4:00 am
Location: Denmark
Contact:

Post by mdj » Sun Feb 12, 2006 6:38 am

Nice tools, didn't know them, thanks for the link! I agree with you, it appears to be a font that is leaking. Serin, can you see the leak with these tools? Or can you knowing it is a font that is the problem see the bug in the code without reproducing it?

We're getting closer! :-)
Morten Due Jørgensen
http://www.mdjnet.dk

User avatar
Serin
Site Administrator
Posts: 1785
Joined: Sat Jan 01, 2005 6:57 pm
Location: United States
Contact:

Post by Serin » Mon May 08, 2006 10:51 am

Thanks for the tool post! Well, I can finally confirm the leak by just looking at the task meter and enabling GDI resource display. It's amazing that Visual Studio 2005(or 2003 or 2000 or 6) doesn't report this.

I haven't run the tool yet, but I will later this week and I'll get this thing fixed. I've narrowed the bug down somewhat, but knowing that it is a font GDI problem is a big help.

Post Reply