Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / November 2007



Tip: Looking for answers? Try searching our database.

Strange Problem with Gdip.dll on Win2003 Server

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marc Allard - 24 Oct 2007 14:17 GMT
Hello,

I have an application in VB6. This application is using gdi Plus (gdip.dll)
and is working perfectly. My customer uses Terminal Server on a Windows 2003
Server (from Windows XP) with no problem at all. I use Gdi Plus to draw some
lines, and fill surfaces... (the customer enters values, and I draw the
result on screen). My problem is the following : The customer never restarts
his computer. My program works perfectly on the server, but after two or
three weeks, my application doesn't print anything on screen. Every gdi plus
function returns SUCCESS, but nothing is drawn on screen. The customer needs
to restart his Windows 2003 Server and my application is working perfectly
for two or three weeks, then the problem appears again. Generally, at least
once a day, the customer restarts my program, but it doesn't change anything.
Does anyone have any idea about how I could do it?

Thank you
Marc
Sinna - 25 Oct 2007 07:44 GMT
> Hello,
>
[quoted text clipped - 13 lines]
> Thank you
> Marc

Seems a (big?) resource leak causing Windows no longer drawing anything.
Please check out your code to assure you clean up all drawing related
objects when they're no longer needed. VB doesn't really know how to
clean them up automatically.

Sinna
Marc Allard - 25 Oct 2007 13:21 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.