473,566 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using innerXml and outerXml on a xmlDataDocument leaks cpu-resourc

Selecting element nodes from a xmlDataDocument using the childNodes
collection or by using selectSingleNod e 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.T imer

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
xmlData.LoadXml ("<root><elemen t/></root>")
timer.Interval = 250
timer.Start()
End Sub

Private Sub timer_Tick(ByVa l sender As Object, ByVal e As
System.EventArg s) 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.Documen tElement.ChildN odes(0).OuterXm l
Next
End Sub
End Class
Regards

Henrik
Nov 12 '05 #1
3 6563
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
7605
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? -- Google Blogoscoped http://blog.outer-court.com
1
8107
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 the XML in the format that ADO uses versus the default format in which ADO.NET uses. Currently, I am using ADO within .NET, but I am concerned about...
2
5477
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 thing as a text element. (with all of the special characters converted) The best solution I've found so far is to do a string replace on all of the...
2
3893
by: James Ankrom | last post by:
Why does this fail? Dim relResources As New Data.DataRelation("Application_Resources", ..Tables("User_Applications").Columns("Application_id"), ..Tables("Resource_Rights").Columns("Application_id"), False) mUserData.Relations.Add(relResources) relResources.Nested = True Dim UserDataXML As System.Xml.XmlDataDocument = New...
6
15467
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> When I read from a file i want to save the XML document in memory of the computer and when i am finished flush it back to the file, that
15
3297
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 content in <items></items> added to my treeview.
2
11934
by: =?Utf-8?B?c2VlbWE=?= | last post by:
What is the differnce between outerXML and innerXML.
0
1036
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 = doc.OuterXml.Length; 1.Advantages: 1.1. It's an approximate value, but the approximation is very good, so I put this as an advantage
4
6779
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 strip/condense non-semantic whitespace. *But* I just found that if you take that self-same XmlDocument and do either XmlDocumentFragment node =...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8108
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.