Re: XmlDataDocument\DataSet Memory Footprint, Feedback appreciated.

From: Sherif ElMetainy (elmeteny.NOSPAM_at_wayout.net.NOSPAM)
Date: 02/13/04


Date: Fri, 13 Feb 2004 22:13:40 +0200

Hello

I suggest you use a memory profiler to track where your memory is consumed.
Here is a good one
http://www.scitech.se/memprofiler/
This software tells you the datatypes of allocated objects

Best regards
Sherif

"Derrick" <derrick1298@excite.com> wrote in message
news:Ooen00m8DHA.712@tk2msftngp13.phx.gbl...
> I am reading in xml files that equate to sql tables, via XmlDataDocument,
> and then operating on the DataSet. With the most simple app that just
loads
> the xml doc, I see the memory footprint of the app grow to roughly 5x the
> size of the xml document after the xml doc is read. Can anyone comment on
> this? Is this expected?
>
> Below are two samples, the first hits northwind, and creates a 19meg
> (roughly, on my machine) xml file. The second simply reads it in, with a
> pause after reading so you can inspect the memory usage in task manager.
>
> Any suggestions as to how I can get the footprint down much closer to the
> size of the xml file would be greatly appreciated.
>
> Thanks in advance!!
>
> Derrick
>
>
>
>
> Creation of sample xml file:
> using System;
> using System.Data;
> using System.Data.SqlClient;
> using System.Xml;
> namespace DataExtract
> {
> class Class1
> {
> [STAThread]
> static void Main(string[] args)
> {
> string forXml = " FOR XML AUTO, XMLDATA";
> SqlConnection mySqlConnection = new
> SqlConnection("server=127.0.0.1;database=northwind;uid=sa;pwd=admin");
> XmlTextReader myXmlReader = null;
> SqlCommand mySqlCmd = new SqlCommand();
> DataSet myDataSet = new DataSet();
> mySqlConnection.Open();
> mySqlCmd.Connection = mySqlConnection;
> mySqlCmd.CommandText = "select * from orders cross join customers" +
forXml;
> myXmlReader = (XmlTextReader)mySqlCmd.ExecuteXmlReader();
> myDataSet.ReadXml(myXmlReader, XmlReadMode.Fragment);
> myXmlReader.Close();
> myDataSet.WriteXml("c:\\lotsa_data.xml");
> myDataSet.WriteXmlSchema("c:\\lotsa_data.xsd");
> myDataSet.Dispose();
> mySqlConnection.Close();
> }
> }
> }
>
> The reader:
>
> using System.Data;
> using System.Xml;
> using System.IO;
> namespace DataRead
> {
> class Class1
> {
> [STAThread]
> static void Main(string[] args)
> {
> Stream xsdStream = new StreamReader("c:\\lotsa_data.xsd").BaseStream;
> Stream xmlStream = new StreamReader("c:\\lotsa_data.xml").BaseStream;
> XmlDataDocument myXmlDoc = new XmlDataDocument();
> myXmlDoc.DataSet.ReadXmlSchema(xsdStream);
> myXmlDoc.Load(xmlStream);
> Console.WriteLine("Loaded...");
> Console.ReadLine();
> }
> }
> }
>
>



Relevant Pages

  • Re: Support of a large table
    ... >> display different parts within different controls of a vb app. ... >> One part of the XML file identifies information about processor cylces. ... >> demanding on memory. ... > Try to open it in vb with DOM first. ...
    (comp.lang.basic.visual.misc)
  • Re: Online, Offline, Disconnected applications.
    ... XML file, ... Using MSDE is the best way. ... I've looked at both the TaskVision application> and the Offline Application Block for for guidance. ... My main concern here is the scalability,> efficiency, and memory usage when the application is running. ...
    (microsoft.public.dotnet.framework.adonet)
  • How2 Flush to Disk DataSet.WriteXML(FileName,XMLWriteMode.WriteSch
    ... A user session consists of long transactions where data is ... wrong with the client machine or application the memory data is lost. ... the XML file is there. ... But if I CTL+AlT-Del and say end task from the task manager, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: remoting object access information from local xml file frequen
    ... it is efficient in using memory .. ... will it hold data in IIS memory automatically after retreiving from the ... > I would do is create a class that loads the xml file settings into the ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: XmlDataDocumentDataSet Memory Footprint, Feedback appreciated.
    ... Thanks, downloaded and tried it out, it basically looks like XML objects ... The code that reads the xml file into a dataset is all core C#... ... > I suggest you use a memory profiler to track where your memory is ... >> namespace DataExtract ...
    (microsoft.public.dotnet.languages.csharp)

Loading