473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

handle count keeps going up

I have a reference to the MSXML4 library via COM (I need to use this
library for legacy XSLT), and my handle count goes up by 4 each time
an object is created and destroyed.

Here is a simple example that will create the problem (you must add a
reference to MSXML4, or MSXML3 with DOMDocument40 changed to
DOMDocument30)

Sub Main()
Do While True
Dim X As New MSXML2.DOMDocument40
X = Nothing
System.Threading.Thread.Sleep(1000)
Loop
End Sub

Any idea what's going on here? I'm guessing that there is some sort
of "lazy garbage disposal" that may happen at some point, but I'd
prefer not to wait that long.

thanks,
Keith
Jul 21 '05 #1
3 4499
Well, you might try to call GC.Collect() and see if that does it. You will
take a performance hit, but how big depends on the situation these objects
are being used in and so on. No two memory usage scenarios are equal.

I wouldn't worry about it of you're running on 2K/XP, unless the handles are
*never* released and eventually cause a problem.

--
____________________
Klaus H. Probst, MVP
http://www.vbbox.com/

"Keith Langer" <ta******@aol.com> wrote in message
news:15**************************@posting.google.c om...
I have a reference to the MSXML4 library via COM (I need to use this
library for legacy XSLT), and my handle count goes up by 4 each time
an object is created and destroyed.

Here is a simple example that will create the problem (you must add a
reference to MSXML4, or MSXML3 with DOMDocument40 changed to
DOMDocument30)

Sub Main()
Do While True
Dim X As New MSXML2.DOMDocument40
X = Nothing
System.Threading.Thread.Sleep(1000)
Loop
End Sub

Any idea what's going on here? I'm guessing that there is some sort
of "lazy garbage disposal" that may happen at some point, but I'd
prefer not to wait that long.

thanks,
Keith

Jul 21 '05 #2
Klaus,

Thanks for the suggestion. Running GC.Collect does the trick. I also
found that System.Runtime.InteropServices.Marshal.ReleaseComO bject
releases the handles.

When I ran my program, the handle count got over 10,000. Is it possible
that the garbage collector isn't running because the reference is not to
a managed object?

Keith


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #3

"Keith Langer" <ta******@aol.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Thanks for the suggestion. Running GC.Collect does the trick. I also
found that System.Runtime.InteropServices.Marshal.ReleaseComO bject
releases the handles.
Yep.
When I ran my program, the handle count got over 10,000. Is it possible
that the garbage collector isn't running because the reference is not to
a managed object?


No, the COM object is still wrapped in a managed object.
--
____________________
Klaus H. Probst, MVP
http://www.vbbox.com/
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kong Li | last post by:
Follow up to this thread, the latest Oracle 9i release 2 patchset (9.2.0.5) fixed the handle count leak problem. The problem is in Oracle client component. Thanks. Kong ----- From: Kong...
3
by: B Moor | last post by:
SServer PC: Win SBS 2003 with 2.6 GHz processor and 1GB RAM SQL Server 2000 v 2000.8.00.76 (sp3) MS Office 2k3 MSJet ms04-014 (latest ost sp8) MDAC v2.8 RTM ADO 2.1 vb6.exe / ADO 2.0 I...
2
by: Tony Johansson | last post by:
Hello! Here I have an Handle body example and reference-counted String Class Copy constructor and Destructor. The class definition is called String and StringRep se below. This class...
4
by: Terry | last post by:
There are a number of things about using unmanaged resources in Windows Forms programming that is unclear to me. In C++, if you loaded an icon resource using "ExtractIcon()", the resource was...
3
by: Keith Langer | last post by:
I have a reference to the MSXML4 library via COM (I need to use this library for legacy XSLT), and my handle count goes up by 4 each time an object is created and destroyed. Here is a simple...
0
by: PlayQ | last post by:
Hello, I am using the C# example code in the WMEncoder Series 9 SDK to encode a series of audio files but after a while I notice a handle leak in the system. The handle count keeps going up until...
2
weaknessforcats
by: weaknessforcats | last post by:
Handle Classes Handle classes, also called Envelope or Cheshire Cat classes, are part of the Bridge design pattern. The objective of the Bridge pattern is to separate the abstraction from the...
2
by: Amit Dedhia | last post by:
Hi I am developing a scientific application which has moderate level image processing involved. In my application, there is a main application form which invokes another form. When this form...
1
by: =?Utf-8?B?QU1lcmNlcg==?= | last post by:
I have a vb.net program that leaks handles as reported by task manager. After running for a couple of hours, task manager reports over 1000 handles, and it continues to grow. I think I am failing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.