472,952 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Using innerXml and outerXml on a xmlDataDocument leaks cpu-resourc

Selecting element nodes from a xmlDataDocument using the childNodes
collection or by using selectSingleNode and then reading innerXml or outerXml
leaks cpu-resources.

A trivial example showing this behaviour is included below.
Running this example increases the cpu-load gradually and reaches 100%
within a minute or two.

The problem exists with innerXml as well as outerXml operations.
Using a xmlDocument instead of a xmlDataDocument does not show this behaviour.

Imports System.Xml

Public Class Form1
Inherits System.Windows.Forms.Form

Private xmlData As New XmlDataDocument
Private WithEvents timer As New Windows.Forms.Timer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
xmlData.LoadXml("<root><element/></root>")
timer.Interval = 250
timer.Start()
End Sub

Private Sub timer_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles timer.Tick
Dim y As String

For i As Integer = 1 To 150 'Actual loop count may be adjusted to
your computer
y = xmlData.DocumentElement.ChildNodes(0).OuterXml
Next
End Sub
End Class
Regards

Henrik
Nov 12 '05 #1
3 6514
Hi Henrik,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #2
Hi Henrik,

The message loop itself is taking almost twice what the XML portion
consumes. We can defer the problem substantially by adding the following
beginning and end of the timer_Tick event:

================
timer.Enabled = False

...

timer.Enabled = True
================

Also, if I bump the timer interval to 500 msec from 250, I never came close
to pegging the CPU.

Note that I haven't changed anything in the System.XML code. Certainly the
XMLDataDocument methods seem to be somewhat more processor-intensive than
the XMLDocument methods, but the internal message loop associated with the
timer events seems to account for the bulk of the CPU usage.

We note there are some CPU issues with the XMLDataDocument Class but the
bulk of the performance difference can be attributed to the messages passed
between the timer and the form. The issue has been escalated to our
developers and we are waiting for feedback on this. We will pass the
feedback along as it becomes available.

Please test the changes above and see if it helps.
Have a good one.

Ken
==============
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Nov 12 '05 #3
Hi Henrik,

We have confirmed this to be a bug in current version of .NET framework. It
will be fixed in the next version.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #4

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

Similar topics

6
by: Philipp Lenssen | last post by:
Why isn't there a way in standard DOM to access all XML of a node? (Similar to what outerHTML and innerHTML can do on Firefox or Internet Explorer when accessing HTML.) Or am I missing something?...
1
by: Shaileen Patel | last post by:
Hi, I am trying to convert a lot of web reports from ASP/VB to ASP.NET/VB.NET. I would like to save my dataset in XML and then use XSLT to transform the XML. The catch is I would like to have...
2
by: Anas M. Nebuchadnezzar XXXVII | last post by:
I am loading an Xml file from a sql server. I have one field that contains child nodes stored as text. The problem is, when I try to imort the dataset into a XmlDataDocument, it loads the whole...
2
by: James Ankrom | last post by:
Why does this fail? Dim relResources As New Data.DataRelation("Application_Resources", ..Tables("User_Applications").Columns("Application_id"),...
6
by: Gerald Maher | last post by:
Hi Reading in XML file using C#, changing elements and saving back to the file, how can i do that ? I want to be able to read an XML file and read out Elements. for example <name>Tom</tom> ...
15
by: janhm | last post by:
Hello. I need to loop through a xml file finding a specific innerxml text and then ad the content to a treeview. For example. If the innerxml im searching for is "item001" then I want the...
2
by: =?Utf-8?B?c2VlbWE=?= | last post by:
What is the differnce between outerXML and innerXML.
0
by: nano2k | last post by:
Hi Is it possible to find out the output size of an XmlDocument object? I mean, a good-enough approach is this: XmlDocument doc = new XmlDocument(); // load data in doc int length =...
4
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... I just noticed something that seems counter-intuitive to me. By default an XmlDocument is set with PreserveWhitespace=false. This means that XmlDocument.Load() or .LoadXml() will...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.