New Windows bug causes GDI leaks in MFC apps
-
For all of you MFC developers out there busy trying to locate what's causing those recent GDI leaks in your app, take a look at this. It turns out running MFC apps on WinXP sp2 and Win2003 leaks GDI resources while XP themes are enabled. The bug report on Microsoft's site is dated this month, so it looks like a recent issue (otherwise I would have been pulling out hairs months ago). Here is their bug report. http://support.microsoft.com/?id=319740[^] I tell ya, this one was driving me nuts for the past week. Going over thousands of lines of code only to discover later that it's not my bug. So, I thought I'd be a good CP member and share this with the rest of you.
-
For all of you MFC developers out there busy trying to locate what's causing those recent GDI leaks in your app, take a look at this. It turns out running MFC apps on WinXP sp2 and Win2003 leaks GDI resources while XP themes are enabled. The bug report on Microsoft's site is dated this month, so it looks like a recent issue (otherwise I would have been pulling out hairs months ago). Here is their bug report. http://support.microsoft.com/?id=319740[^] I tell ya, this one was driving me nuts for the past week. Going over thousands of lines of code only to discover later that it's not my bug. So, I thought I'd be a good CP member and share this with the rest of you.
Joshua Quick wrote:
It turns out running MFC apps on WinXP sp2 and Win2003 leaks GDI resources while XP themes are enabled.
Really? I thought MFC leaked resources, period. No wait, it's any Windows OS that leaks resources. No wait... Ah, heck, the only thing I can remember is to reboot my computer every day. ;P Marc My website Traceract Understanding Simple Data Binding Diary Of A CEO - Preface
-
For all of you MFC developers out there busy trying to locate what's causing those recent GDI leaks in your app, take a look at this. It turns out running MFC apps on WinXP sp2 and Win2003 leaks GDI resources while XP themes are enabled. The bug report on Microsoft's site is dated this month, so it looks like a recent issue (otherwise I would have been pulling out hairs months ago). Here is their bug report. http://support.microsoft.com/?id=319740[^] I tell ya, this one was driving me nuts for the past week. Going over thousands of lines of code only to discover later that it's not my bug. So, I thought I'd be a good CP member and share this with the rest of you.
Wow - given that W2000 kindly handles those sort of leaks ( so if you write on W2000, you need to test on W98 ), that's a bit of a doozie. Christian Graus - Microsoft MVP - C++
-
Wow - given that W2000 kindly handles those sort of leaks ( so if you write on W2000, you need to test on W98 ), that's a bit of a doozie. Christian Graus - Microsoft MVP - C++
Christian Graus wrote:
that's a bit of a doozie.
No kidding. Since my apps are designed to run 24/7/365, this issue is a big deal to me.
-
Joshua Quick wrote:
It turns out running MFC apps on WinXP sp2 and Win2003 leaks GDI resources while XP themes are enabled.
Really? I thought MFC leaked resources, period. No wait, it's any Windows OS that leaks resources. No wait... Ah, heck, the only thing I can remember is to reboot my computer every day. ;P Marc My website Traceract Understanding Simple Data Binding Diary Of A CEO - Preface
:-D
-
Wow - given that W2000 kindly handles those sort of leaks ( so if you write on W2000, you need to test on W98 ), that's a bit of a doozie. Christian Graus - Microsoft MVP - C++
Anyone remember the fun and games of Win95's GDI? cheers, Chris Maunder
CodeProject.com : C++ MVP
-
Anyone remember the fun and games of Win95's GDI? cheers, Chris Maunder
CodeProject.com : C++ MVP
Do you mean before Win98 added stuff like TransparentBlt ? Or just managing GDI handles in general ? Christian Graus - Microsoft MVP - C++
-
Do you mean before Win98 added stuff like TransparentBlt ? Or just managing GDI handles in general ? Christian Graus - Microsoft MVP - C++
I mean that you were strictly limited in the number of GDI objects you could create (without releasing) before the system started refusing to grant you more. You quickly learned to check the return values of system calls :) cheers, Chris Maunder
CodeProject.com : C++ MVP
-
I mean that you were strictly limited in the number of GDI objects you could create (without releasing) before the system started refusing to grant you more. You quickly learned to check the return values of system calls :) cheers, Chris Maunder
CodeProject.com : C++ MVP
Oh, OK. I didn't recall that, especially, but I believe you :-) Was the limit really small and then grew in W98 ? I did write a paint program for W95, but I developed it using W98 and then 2000. Christian Graus - Microsoft MVP - C++
-
Oh, OK. I didn't recall that, especially, but I believe you :-) Was the limit really small and then grew in W98 ? I did write a paint program for W95, but I developed it using W98 and then 2000. Christian Graus - Microsoft MVP - C++
Christian Graus wrote:
Was the limit really small and then grew in W98 ?
It was really small and didn't grow noticably in Win98 - at least it wasn't enough for me to notice much. All the Win9_x_ versions suffer from the fixed system resource problem. It's a nostalgic memory looking back, but I wouldn't return to those days. ;)
-
Oh, OK. I didn't recall that, especially, but I believe you :-) Was the limit really small and then grew in W98 ? I did write a paint program for W95, but I developed it using W98 and then 2000. Christian Graus - Microsoft MVP - C++
Better! It was really small in W95 and W98, but the shell itself used more in W98, so you essentially started out closer to the ceiling. I remember in particular one 3rd-party control (a grid) that could display small images, but refused to release their handles until it was destroyed. Many a curse was heard from the direction of QA, as their stress-tests failed spectacularly half-way through with a Win3.1-ish "white screen of lameness". I ended up writing a beautiful hack to draw all the images over the top of the grid once it was done drawing itself - ah, good times... :rolleyes:
My god, you're a genius! - Jörgen Sigvardsson, The Lounge
-
Better! It was really small in W95 and W98, but the shell itself used more in W98, so you essentially started out closer to the ceiling. I remember in particular one 3rd-party control (a grid) that could display small images, but refused to release their handles until it was destroyed. Many a curse was heard from the direction of QA, as their stress-tests failed spectacularly half-way through with a Win3.1-ish "white screen of lameness". I ended up writing a beautiful hack to draw all the images over the top of the grid once it was done drawing itself - ah, good times... :rolleyes:
My god, you're a genius! - Jörgen Sigvardsson, The Lounge
Shog9 wrote:
It was really small in W95 and W98, but the shell itself used more in W98, so you essentially started out closer to the ceiling.
I don't remember Win98 1st Edition being much worse off as far as that, but Win98SE definitely was. You'd restart and then you'd barely do anything before you'd have to restart again.
-
Oh, OK. I didn't recall that, especially, but I believe you :-) Was the limit really small and then grew in W98 ? I did write a paint program for W95, but I developed it using W98 and then 2000. Christian Graus - Microsoft MVP - C++
Does someone remember
GetFreeSystemResources
? everyone used it to show a little number in their About box... as if users did care! :laugh: -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-
I mean that you were strictly limited in the number of GDI objects you could create (without releasing) before the system started refusing to grant you more. You quickly learned to check the return values of system calls :) cheers, Chris Maunder
CodeProject.com : C++ MVP
-
Win 2.0 was even worse still.;) Mind you thankfully that is but a faint memory. Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
-
For all of you MFC developers out there busy trying to locate what's causing those recent GDI leaks in your app, take a look at this. It turns out running MFC apps on WinXP sp2 and Win2003 leaks GDI resources while XP themes are enabled. The bug report on Microsoft's site is dated this month, so it looks like a recent issue (otherwise I would have been pulling out hairs months ago). Here is their bug report. http://support.microsoft.com/?id=319740[^] I tell ya, this one was driving me nuts for the past week. Going over thousands of lines of code only to discover later that it's not my bug. So, I thought I'd be a good CP member and share this with the rest of you.
Recent? You must be joking - this issue is at least 12 months old - I first reported it here on CP in September last year. I also successfully got MS to release a patch for this bug, which I view as a personal triumph! I assure you that this problem will have been affecting your MFC apps since XP SP2 was released. Way to go MS! http://www.codeproject.com/lounge.asp?msg=927571&searchkw=mfc+leak&sd=1%2F1%2F2003&ed=10%2F25%2F2005#xx927571xx[^]
The Rob Blog
Google Talk: robert.caldecott http://www.codeproject.com/script/comments/forums.asp?msg=927057&forumid=2605&searchkw=mfc+leak+hrgn&sd=1%2F1%2F2004&ed=12%2F31%2F2004#xx927057xx[^] -- modified at 3:18 Tuesday 25th October, 2005 -
Anyone remember the fun and games of Win95's GDI? cheers, Chris Maunder
CodeProject.com : C++ MVP
Yes. I'm glad I have more than 64K to work with these days. ;) --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?
-
I mean that you were strictly limited in the number of GDI objects you could create (without releasing) before the system started refusing to grant you more. You quickly learned to check the return values of system calls :) cheers, Chris Maunder
CodeProject.com : C++ MVP
How dare you post a programming question in the Lou... Oh, it's you, Chris! No, don't mind me... nothing at all... just thought I'd say Hi. ;P Cheers, Vikram.
http://www.geocities.com/vpunathambekar
Google talk: binarybandit
After all is said and done, much is said and little is done.
-
Recent? You must be joking - this issue is at least 12 months old - I first reported it here on CP in September last year. I also successfully got MS to release a patch for this bug, which I view as a personal triumph! I assure you that this problem will have been affecting your MFC apps since XP SP2 was released. Way to go MS! http://www.codeproject.com/lounge.asp?msg=927571&searchkw=mfc+leak&sd=1%2F1%2F2003&ed=10%2F25%2F2005#xx927571xx[^]
The Rob Blog
Google Talk: robert.caldecott http://www.codeproject.com/script/comments/forums.asp?msg=927057&forumid=2605&searchkw=mfc+leak+hrgn&sd=1%2F1%2F2004&ed=12%2F31%2F2004#xx927057xx[^] -- modified at 3:18 Tuesday 25th October, 2005Robert Edward Caldecott wrote:
Recent? You must be joking - this issue is at least 12 months old
:wtf: Crap! If this is true, then... 1) All of my long running MFC apps are in jeopardy. 2) Microsoft is seriously not cool. They should have fixed this via Windows Update a long time ago. 3) I made a repost. D'oh! Interestingly enough, I haven't heard of any my long running MFC apps bombing in the past year. These apps run 24/7/365 and periodically create and destroy MDI child windows. Are you sure MS didn't fix this? Anyways, where can I download this patch? (Don't tell me I have to go through their tech support team, do I?)
-
Robert Edward Caldecott wrote:
Recent? You must be joking - this issue is at least 12 months old
:wtf: Crap! If this is true, then... 1) All of my long running MFC apps are in jeopardy. 2) Microsoft is seriously not cool. They should have fixed this via Windows Update a long time ago. 3) I made a repost. D'oh! Interestingly enough, I haven't heard of any my long running MFC apps bombing in the past year. These apps run 24/7/365 and periodically create and destroy MDI child windows. Are you sure MS didn't fix this? Anyways, where can I download this patch? (Don't tell me I have to go through their tech support team, do I?)
They may well of patched this via a Windows Update - there is no way of telling. And yes, I had to go through MS tech support for the hot-fix, so I am not meant to give it to you. :( Oh, and MS support sent me the KB319740 link 12 months ago too. I did find a workaround though - make a call to SetWindowTheme(hWnd, L"", L"") in OnCreate. This means your MDI child windows won't get the XP theme look to their captions, but you'll still get themed controls, etc.
The Rob Blog
Google Talk: robert.caldecott