Click here to Skip to main content
16,004,836 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Doesn't anyone here know anything about DeskBands? Pin
21-May-02 10:52
suss21-May-02 10:52 
GeneralRe: Doesn't anyone here know anything about DeskBands? Pin
21-May-02 10:49
suss21-May-02 10:49 
GeneralCP web services Pin
Ravi Bhavnani20-May-02 17:28
professionalRavi Bhavnani20-May-02 17:28 
GeneralRe: CP web services Pin
Rama Krishna Vavilala20-May-02 17:34
Rama Krishna Vavilala20-May-02 17:34 
GeneralRe: CP web services Pin
Ravi Bhavnani20-May-02 17:42
professionalRavi Bhavnani20-May-02 17:42 
GeneralRe: CP web services Pin
Rama Krishna Vavilala20-May-02 17:35
Rama Krishna Vavilala20-May-02 17:35 
GeneralRe: CP web services Pin
Ravi Bhavnani20-May-02 17:44
professionalRavi Bhavnani20-May-02 17:44 
QuestionGDI Resouce Leak? Pin
perlmunger20-May-02 16:15
perlmunger20-May-02 16:15 
I'm still pretty new to GDI programming, but it was my understanding that as long as I select the original GDI object back into the DC, the resource would be cleaned up properly when it goes out of scope ( I am not using pointers for these objects ). What I don't understand is why the GDI resouce count ( in the Task manager under Windows 2000 ) shows the GDI resouces growing to an unmanageable amount in a very short period of time ( e.g. 2,000 in under a minute of program execution ).

Here's what I've done. I have a multi-threaded application that draws bar graphs to the screen (among other things, but we'll just focus on the bar graphs). One thread reads data from the serial port and writes it to a global data structure. A draw thread then gets notified that it has updating to do and it reads data from that data structure. That draw thread then calls Draw() on a global bar graph container object.

I have created a bar graph library that abstracts the bar graph functionality. The container class I mentioned above (CObject inherited), holds four bar graphs and is responsible to update internal data of each of the graphs. One of these container objects is used throughout the program and is global. I call Draw() on this container class (passing it a DC) both in the view's OnDraw and also in a secondary draw thread (as mentioned above) (CWinThread inherited). I synchronize access with a critical section. I think that the problem is in this global class.

Is there something about global classes that I am not taking into account here when it comes to GDI? My GDI objects that I create are created in the scope of the function (method) and not in the the class scope (e.g. m_gdiObjectName ).

Any suggestions would be helpful ( I hope I've been clear enough ).

Thanks.

-Matt

------------------------------------------

The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
AnswerRe: GDI Resouce Leak? Pin
Paul M Watt20-May-02 17:21
mentorPaul M Watt20-May-02 17:21 
GeneralRe: GDI Resouce Leak? Pin
perlmunger20-May-02 17:30
perlmunger20-May-02 17:30 
GeneralRe: GDI Resouce Leak? Pin
Paul M Watt20-May-02 17:33
mentorPaul M Watt20-May-02 17:33 
GeneralRe: GDI Resouce Leak? Pin
perlmunger20-May-02 17:49
perlmunger20-May-02 17:49 
Generalsimple CSockets program Pin
Pyropat20-May-02 16:11
Pyropat20-May-02 16:11 
GeneralRe: simple CSockets program Pin
perlmunger20-May-02 16:48
perlmunger20-May-02 16:48 
GeneralRe: simple CSockets program Pin
Nish Nishant20-May-02 17:20
sitebuilderNish Nishant20-May-02 17:20 
GeneralRe: simple CSockets program Pin
Rickard Andersson2020-May-02 20:44
Rickard Andersson2020-May-02 20:44 
GeneralRe: simple CSockets program Pin
Nish Nishant20-May-02 23:06
sitebuilderNish Nishant20-May-02 23:06 
GeneralRe: simple CSockets program Pin
Rickard Andersson2021-May-02 0:41
Rickard Andersson2021-May-02 0:41 
GeneralRe: Bug is here... Pin
Matt Gullett20-May-02 15:47
Matt Gullett20-May-02 15:47 
GeneralRe: Bug is here... Pin
Rama Krishna Vavilala20-May-02 16:22
Rama Krishna Vavilala20-May-02 16:22 
GeneralRe: Bug is here... Pin
Nish Nishant20-May-02 17:22
sitebuilderNish Nishant20-May-02 17:22 
GeneralRe: Bug is here... Pin
Paul M Watt20-May-02 17:31
mentorPaul M Watt20-May-02 17:31 
GeneralRe: Bug is here... Pin
Aizik Yair20-May-02 19:50
Aizik Yair20-May-02 19:50 
GeneralAdding a project to existing workspace Pin
Coremn20-May-02 15:24
Coremn20-May-02 15:24 
GeneralRe: Adding a project to existing workspace Pin
perlmunger20-May-02 17:25
perlmunger20-May-02 17:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.