Click to See Complete Forum and Search --> : XQuery


George2
June 6th, 2008, 02:02 AM
Hello everyone,


I am writing XQuery based on an XML file. I am using instance type of XPathDocument, XPathNavigator, XPathExpression and XPathNodeIterator.

My question is does any of them need to be released to free resource? I have not found any Close/Dispose methods for them. It is so strange to me since at least the XML file to be queried needs to be closed.


thanks in advance,
George

cjard
June 6th, 2008, 03:17 AM
Geroge, if you want to know why Microsoft didnt implement XPathNavigator.Dispose, write to Microsoft.

I'd probably hate reading your code, given that you seem to obsess about resource disposal I reckon a good percentage of it would be doing away with variables that are going to be disposed of in a few nanoseconds anyway (thanks to scope)

Go do some work, and stop worrying about everything; if you want to micromanage memory usage, use C++

George2
June 6th, 2008, 03:33 AM
Hi cjard,


I am using Perfmon to monitor the Handle Count of my C# application process, and it continues to grow. I do not know what happened, so I investigating each part of code which needs resource release.

Geroge, if you want to know why Microsoft didnt implement XPathNavigator.Dispose, write to Microsoft.

I'd probably hate reading your code, given that you seem to obsess about resource disposal I reckon a good percentage of it would be doing away with variables that are going to be disposed of in a few nanoseconds anyway (thanks to scope)

Go do some work, and stop worrying about everything; if you want to micromanage memory usage, use C++


regards,
George

cjard
June 6th, 2008, 04:24 AM
I dont know for certain, but the figure youre looking at might be misleading because it might include references that havent been garbage collected yet. Dont worry about big numbers too much; they dont always indicate a problem that needs fixing immediately

George2
June 6th, 2008, 04:38 AM
Thanks cjard,


From your help, I think there is no need to release any resource mentioned in my original post, looks like all types I mentioned has no need to release resource. Correct? :-)

I dont know for certain, but the figure youre looking at might be misleading because it might include references that havent been garbage collected yet. Dont worry about big numbers too much; they dont always indicate a problem that needs fixing immediately


regards,
George