473,671 Members | 2,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exception of type System.OutOfMem oryException is thrown

Hi,
There are several pages that occasionally start throwing
System.OutOfMem oryException and "The type initializer for
"Microsoft.Prac tices.Enterpris eLibrary.Data.I nstrumentation. DataCommandFail edEvent
exception."
The problem goes away after iisreset .

- Actually on Excel Exporting this error happens and stops all the
applications in the server
- It exceeds more than 1GB size, i hope so in server
-

How to solve this problem? How to reduce size of Dataset when exporting
to excel file?
Help me out in this...
Thanks in advance

-karups

Oct 18 '06 #1
5 7769
You may wish to clarify what exactly your code is doing... it isn't entirely
clear from the post.

Initial thoughts:
* Are you using Excel directly on the server? Yup, that might not scale so
well...
* Reduce the size of the DataSet =work with less data...
* ...or, work with a "streaming" approach rather than an "in memory"
approach - i.e. it loads a record ([or a few, or dozens, or hundreds, but
not millions] at a time) from the source, processes (writes?) that record /
those records, and *then* moves on. Think IDataReader, Stream, etc

Maybe if you can clarify what you are trying to achieve somebody can suggest
a better approach.

Marc
Oct 18 '06 #2
My application will have a fetch button.
As soon as we click the fetch button..It calls a Stored Procedure.
The stored procedure will return a dataset back(huge on with rows 25000
and col:52)...
I export this dataset to excel using this code

Response.Clear( );
Response.AddHea der("content-disposition",
"attachment;fil ename="+filenam e+".xls");
Response.Charse t = "";
this.EnableView State=false;
Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);
Response.Conten tType = "applicatio n/vnd.xls";
System.IO.Strin gWriter stringWrite = new System.IO.Strin gWriter();
System.Web.UI.H tmlTextWriter htmlWrite = new
HtmlTextWriter( stringWrite);
DataGrid myDataGrid=new DataGrid();
myDataGrid.Data Source=dsReport .Tables[1];
myDataGrid.Data Bind();
myDataGrid.Rend erControl(htmlW rite);
Response.Write( stringWrite.ToS tring());
Response.End();

While doing this i get the OutOfMemoryExce ption..

Oct 18 '06 #3
My application will have a fetch button.
As soon as we click the fetch button..It calls a Stored Procedure.
The stored procedure will return a dataset back(huge on with rows 25000
and col:52)...
I export this dataset to excel using this code

Response.Clear( );
Response.AddHea der("content-disposition",
"attachment;fil ename="+filenam e+".xls");
Response.Charse t = "";
this.EnableView State=false;
Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);
Response.Conten tType = "applicatio n/vnd.xls";
System.IO.Strin gWriter stringWrite = new System.IO.Strin gWriter();
System.Web.UI.H tmlTextWriter htmlWrite = new
HtmlTextWriter( stringWrite);
DataGrid myDataGrid=new DataGrid();
myDataGrid.Data Source=dsReport .Tables[1];
myDataGrid.Data Bind();
myDataGrid.Rend erControl(htmlW rite);
Response.Write( stringWrite.ToS tring());
Response.End();

While doing this i get the OutOfMemoryExce ption..

Oct 18 '06 #4
It seems to be well known issue, but the solution is not so trival
Obviously the reason is that your managed heap is overly fragmented that FW
couldn't find free 64mb heap segment to allocate memory.

There are several descriptions in the net about how to investigate this
problem, especially Tess blog (MS escalation engineer)
I recomend to read this recend article
http://msdn.microsoft.com/msdnmag/is...t/default.aspx that
describes your aspect of problem

--
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


"karups" wrote:
My application will have a fetch button.
As soon as we click the fetch button..It calls a Stored Procedure.
The stored procedure will return a dataset back(huge on with rows 25000
and col:52)...
I export this dataset to excel using this code

Response.Clear( );
Response.AddHea der("content-disposition",
"attachment;fil ename="+filenam e+".xls");
Response.Charse t = "";
this.EnableView State=false;
Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);
Response.Conten tType = "applicatio n/vnd.xls";
System.IO.Strin gWriter stringWrite = new System.IO.Strin gWriter();
System.Web.UI.H tmlTextWriter htmlWrite = new
HtmlTextWriter( stringWrite);
DataGrid myDataGrid=new DataGrid();
myDataGrid.Data Source=dsReport .Tables[1];
myDataGrid.Data Bind();
myDataGrid.Rend erControl(htmlW rite);
Response.Write( stringWrite.ToS tring());
Response.End();

While doing this i get the OutOfMemoryExce ption..

Oct 18 '06 #5
Thank you.I read the article,That was useful information.
But can you tell me a way to rectify in my application if possible..

Oct 20 '06 #6

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

Similar topics

42
2372
by: cody | last post by:
public DateTime Value { get { try { return new DateTime(int.Parse(tbYear.Text), int.Parse(tbMonth.Text), int.Parse(tbDay.Text)); } catch (FormatException)
40
13511
by: Kevin Yu | last post by:
is it a bad programming design to throw exception in the try block then catch it??
1
3440
by: Ripul Handa | last post by:
Hi We are running IIS 5.0 cluster with cisco local director. We are running a website on 2 webservers and I have been observing that from past few days we have are getting this error message of and on Error Messag Remote IP:66.122.242.6 Host:216.211.212.2
11
21010
by: Pete Davis | last post by:
I have an app that's dealing with a few hundred bitmap thumbnails. I only instantiate the bitmaps that are visible at a given time and dispose of them if they get scrolled out of view. I've used the .NET memory profiler and I've verified there's no leak in my bitmaps, nor are there any other apparent leaks. So, at a given time, there may be 30 or so bitmaps displayed at a given time. Still, somehow, I'm getting random errors in the...
1
4979
by: SMG - Idealake | last post by:
Hi all, I am getting following error on my error, what could be the reason? Exception of type System.OutOfMemoryException was thrown. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.OutOfMemoryException: Exception of type System.OutOfMemoryException was thrown.
3
1838
by: elziko | last post by:
I have a procedure that creates a bitmap of a certain size and then displays it in a 3rd party component. However, if the bitmap is very large then a System.OutOfMemoryException is thrown my something but my codes breaks at the difition of my class: "Public Class MainForm" ....so I'm assuming that the OutOfMemoryException occurs in the 3rd party since I have put a Try-Catch block around my bitmap creation code and I am
1
2357
by: karups | last post by:
Hi, There are several pages that occasionally start throwing System.OutOfMemoryException and "The type initializer for "Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataCommandFailedEvent exception." The problem goes away after iisreset . - Actually on Excel Exporting this error happens and stops all the
11
7024
by: Don | last post by:
When using Visual Basic .NET with a reference to Interop.Outlook, is there a way to get more detailed information about an error other than Exception.Message or Exception.ToString? For example, Outlook's MailItem.SaveAs method can return an error message of "The operation failed", but I have no idea what that means. As a test, I tried SaveAs using a filename that contained illegal characters and got the error message "Internal Application...
1
7987
by: chandhrakv | last post by:
Hi experts, Can any one please respond with the resolution. Machine: WIN2K3, ASP.NET application, .NET 2.0 with June 2007 hotfix installed recently. Facing daily 1000 errors with the same type hopefully. Please assist. ----- Event code: 3005 Event message: An unhandled exception has occurred. Event time: 11/18/2009 10:48:23 AM Event time (UTC): 11/18/2009 5:18:23 AM Event ID: 6418c83513d4492bb14bc36994b95996
0
8485
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8403
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8930
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8605
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7446
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6238
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.