Re: XmlDataDocument\DataSet Memory Footprint, Feedback appreciated.
From: Sherif ElMetainy (elmeteny.NOSPAM_at_wayout.net.NOSPAM)
Date: 02/13/04
- Next message: Angel: "tools to create hlp files for application"
- Previous message: Sherif ElMetainy: "Re: Format question"
- In reply to: Derrick: "XmlDataDocument\DataSet Memory Footprint, Feedback appreciated."
- Next in thread: Derrick: "Re: XmlDataDocument\DataSet Memory Footprint, Feedback appreciated."
- Reply: Derrick: "Re: XmlDataDocument\DataSet Memory Footprint, Feedback appreciated."
- Messages sorted by: [ date ] [ thread ]
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();
> }
> }
> }
>
>
- Next message: Angel: "tools to create hlp files for application"
- Previous message: Sherif ElMetainy: "Re: Format question"
- In reply to: Derrick: "XmlDataDocument\DataSet Memory Footprint, Feedback appreciated."
- Next in thread: Derrick: "Re: XmlDataDocument\DataSet Memory Footprint, Feedback appreciated."
- Reply: Derrick: "Re: XmlDataDocument\DataSet Memory Footprint, Feedback appreciated."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|