|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Getting out of memory when DataSet.GetXml()When the dataset is too large it thows OutOfMemory Exception although
that there is enough momory on the web server, is this a bug in .net or something must be configured?! The Dataset contains near 50 000 rows. How can I escape this. Please help? ..net handles memory a bit differently and might use more memory than the
size of dataset file when loading. Did you try adding memory? How much memory do your server have and how large is the xml file? -- Show quoteMiha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "OverTheTop" <vanko.georg***@gmail.com> wrote in message news:1172848118.781548.201860@30g2000cwc.googlegroups.com... > When the dataset is too large it thows OutOfMemory Exception although > that there is enough momory on the web server, is this a bug in .net > or something must be configured?! The Dataset contains near 50 000 > rows. How can I escape this. Please help? > Hi Miha
the web server has 1.5 GB free memory...but when the exception was trown the memory on the server used was 150 MB...I don't know why the server didn't use all his memory available...may be .net is playing stupied...I don't know what is the size of the dataset...sorry...Monday on work I'll check :) Miha Markic [MVP C#] íàïèñà: Show quote > .net handles memory a bit differently and might use more memory than the > size of dataset file when loading. > Did you try adding memory? How much memory do your server have and how large > is the xml file? > > -- > Miha Markic [MVP C#, INETA Country Leader for Slovenia] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > > "OverTheTop" <vanko.georg***@gmail.com> wrote in message > news:1172848118.781548.201860@30g2000cwc.googlegroups.com... > > When the dataset is too large it thows OutOfMemory Exception although > > that there is enough momory on the web server, is this a bug in .net > > or something must be configured?! The Dataset contains near 50 000 > > rows. How can I escape this. Please help? > > Hm, that's odd.
The problem when you see much memory available and you get outofmemory exception might be caused by memory fragmentation. Or perhpas there is a bug somewhere, hard to tell. -- Miha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "OverTheTop" <vanko.georg***@gmail.com> wrote in message the web server has 1.5 GB free memory...but when the exception wasnews:1172922426.724358.81810@t69g2000cwt.googlegroups.com... Hi Miha trown the memory on the server used was 150 MB...I don't know why the server didn't use all his memory available...may be .net is playing stupied...I don't know what is the size of the dataset...sorry...Monday on work I'll check :) Miha Markic [MVP C#] íàïèñà: Show quote > .net handles memory a bit differently and might use more memory than the > size of dataset file when loading. > Did you try adding memory? How much memory do your server have and how > large > is the xml file? > > -- > Miha Markic [MVP C#, INETA Country Leader for Slovenia] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > > "OverTheTop" <vanko.georg***@gmail.com> wrote in message > news:1172848118.781548.201860@30g2000cwc.googlegroups.com... > > When the dataset is too large it thows OutOfMemory Exception although > > that there is enough momory on the web server, is this a bug in .net > > or something must be configured?! The Dataset contains near 50 000 > > rows. How can I escape this. Please help? > > On 2 Mar 2007 07:08:38 -0800, OverTheTop wrote:
> When the dataset is too large it thows OutOfMemory Exception although Well ... for starters I would try to see if I can get the size of the> that there is enough momory on the web server, is this a bug in .net > or something must be configured?! The Dataset contains near 50 000 > rows. How can I escape this. Please help? dataset down. Is it possible to load less data? Hi Rad
Because of the application there is no way of loading less data... Rad [Visual C# MVP] íàïèñà: Show quote > On 2 Mar 2007 07:08:38 -0800, OverTheTop wrote: > > > When the dataset is too large it thows OutOfMemory Exception although > > that there is enough momory on the web server, is this a bug in .net > > or something must be configured?! The Dataset contains near 50 000 > > rows. How can I escape this. Please help? > > Well ... for starters I would try to see if I can get the size of the > dataset down. Is it possible to load less data? > > -- > Bits.Bytes > http://bytes.thinkersroom.com The other way would be to deal with it as an XML document.
-- Show quoteMiha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "OverTheTop" <vanko.georg***@gmail.com> wrote in message news:1172848118.781548.201860@30g2000cwc.googlegroups.com... > When the dataset is too large it thows OutOfMemory Exception although > that there is enough momory on the web server, is this a bug in .net > or something must be configured?! The Dataset contains near 50 000 > rows. How can I escape this. Please help? > Yes I was thinking of something like this...first use
DataSet.WriteXml(tempFile) and then use a XmlDocument to load the tempFile and get the xml string representation of the DataSet. Is that what you suggest? Is this gonna solve this issue? Miha Markic [MVP C#] íàïèñà: Show quote > The other way would be to deal with it as an XML document. > > -- > Miha Markic [MVP C#, INETA Country Leader for Slovenia] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > "OverTheTop" <vanko.georg***@gmail.com> wrote in message > news:1172848118.781548.201860@30g2000cwc.googlegroups.com... > > When the dataset is too large it thows OutOfMemory Exception although > > that there is enough momory on the web server, is this a bug in .net > > or something must be configured?! The Dataset contains near 50 000 > > rows. How can I escape this. Please help? > > "OverTheTop" <vanko.georg***@gmail.com> wrote in message Yes I was thinking of something like this...first usenews:1172923026.298833.105280@v33g2000cwv.googlegroups.com... DataSet.WriteXml(tempFile) and then use a XmlDocument to load the tempFile and get the xml string representation of the DataSet. Is that what you suggest? Is this gonna solve this issue? Yes, or even less memory problematic if you use XmlReader that doesn't load everything - it is just some sort of cursor. -- Miha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/
Show quote
On Mar 3, 2:28 pm, "Miha Markic [MVP C#]" <miha at rthand com> wrote: this how i do it now> "OverTheTop" <vanko.georg***@gmail.com> wrote in message > > news:1172923026.298833.105280@v33g2000cwv.googlegroups.com... > > Yes I was thinking of something like this...first use > DataSet.WriteXml(tempFile) and then use a XmlDocument to load the > tempFile and get the xml string representation of the DataSet. Is that > what you suggest? Is this gonna solve this issue? > > Yes, or even less memory problematic if you use XmlReader that doesn't load > everything - it is just some sort of cursor. > > -- > Miha Markic [MVP C#, INETA Country Leader for Slovenia] > RightHand .NET consulting & developmentwww.rthand.com > Blog:http://cs.rthand.com/blogs/blog_with_righthand/ string xmlDataSet = null; string tempFile = Path.GetTempFileName(); FileInfo fi = new FileInfo(tempFile); if(fi.Exists) { ds.WriteXml(tempFile); using(StreamReader sr = fi.OpenText()) { xmlDataSet = sr.ReadToEnd(); sr.Close(); } fi.Delete(); About sr.ReadToEnd() method...can also throw outofmemory exception, but can I escape this, because String in .Net is stored in the heap (in memory) so if the hardware can't hold it, noone can. Corrent me if I am wrong? So is this the best solution I can think of? |
|||||||||||||||||||||||