Hello,
Thank you for your answer.
I was thinking about it too, but when I open the window to do the drawing,
and then I close it, I hane the same number of GDI objects (before the
opening and after the closing), but sometimes, I have a small difference (1
object more).Could it mean that after something like 4000 or 5000 objects,
gdi+ won't work? Also, does it mean that when I close the program, all the
opened resources (GDI Plus) that are opened will never be closed? If my
program crashes (or is killed by the task manager), does it mean that all the
opened GDI Plus objects won't be destroyed from memory?
In that case, why is my program the only affected? All the other programs on
the computer have no problem with GDI+?
Is there something to do to avoid the limit?
Thank you
Marc
> > Hello,
> >
[quoted text clipped - 20 lines]
>
> Sinna
Sinna - 26 Oct 2007 07:40 GMT
> Hello,
> Thank you for your answer.
[quoted text clipped - 13 lines]
> Thank you
> Marc
<snip>
<quote>
... sometimes, I have a small difference ...
</quote>
This means you have a resource leak. If you wait long enough, you don't
have any resources left resulting in the behavior you're seeing.
<quote>
... does it mean that when I close the program, all the opened resources
(GDI+) that are opened will never be closed?
</quote>
It depends. If you don't clean them up manually, the resources they're
consuming are not freed.
<quote>
If my program crashes...
</quote>
Don't know for sure. AFAIK recent Windows OSes release the memory
allocated by the crashed application automatically, but I don't know if
GDI+ resource related stuff is running in the same memory/application
space as the program that created them.
<quote>
... why is my program the only affected?
</quote>
I don't know how you know that your program is the only one. Perhaps is
the only one using GDI+ routines/resources. It also can be (wild
guessing) that each process gets a restricted amount of resources. When
consumed, new allocations are no longer allowed.
<quote>
Is there something to do to avoid the limit?
</quote>
Of course, but it won't be easy to travel through your implementation to
see where possible resource leaks occur.
Let me give you one important tip: destroy the objects you created in
the reversed order they were created, otherwise some objects won't
release their resources as another object still has a reference to it.
Sinna
Marc Allard - 26 Oct 2007 07:52 GMT
Hello,
Thank you for your answer. It is time for me to do a lot of "searching" in
the code.
Marc Allcomp
> > Hello,
> > Thank you for your answer.
[quoted text clipped - 57 lines]
>
> Sinna
Gigasoft - 03 Nov 2007 23:06 GMT
Hi,
You create GDI objects, use them, and then destroy them. There's usually no
need to keep them around and usually very easy to keep track of them.
TaskManager is easiest way to track GDI objects, and many other resources
for your app.
If you suspect an area, create a loop that calls suspect code 10K times.
Comment out block sections and then start uncommenting and testing. Usually
very easy to find this way.
best regards,
Robert Dede
Gigasoft, Inc.
www.gigasoft.com
> Hello,
>
[quoted text clipped - 70 lines]
>>
>> Sinna