outofmemoryexception

Visual Studio Error: The "GenerateResource" task failed unexpectedly.

Hi, When building a VS 2008 solution with 19 projects I sometimes get: The "GenerateResource" task failed unexpectedly. System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at System.IO.MemoryStream.set_Capacity(Int32 value) at System.IO.MemoryStream.EnsureCapacity(Int32 value) at System.IO.M...

How do I handle large SQL SERVER batch inserts?

I'm looking to execute a series of queries as part of a migration project. The scripts to be generated are produced from a tool which analyses the legacy database then produces a script to map each of the old entities to an appropriate new record. THe scripts run well for small entities but some have records in the hundreds of thousands ...

Will the GAC fix an ASP.NET/IIS6.0 System.OutOfMemoryException?

I have many instances of an application installed on an IIS 6.0, Windows Server 2003 box under the same application pool. They share many of the same assemblies and can not be joined in to a single application. I recently added a new instance of the application and obtained a System.OutOfMemoryException when I tried to load the ASP.NET...

StringBuilder for string concatenation throws OutOfMemoryException.

We mostly tend to following the above best practice. Have a look at String vs StringBuilder But StringBuilder could throw OutOfMemoryException even when there is sufficient memory available. It throws OOM exception because it needs "continuous block of memory". Some links for reference StringBuilder OutOfMemoryException and there ar...

Is there any memory restrictions on an ASP.Net application?

I have an ASP.Net MVC application that allows users to upload images. When I try to upload a really large file (400MB) I get an error. I assumed that my image processing code (home brew) was very inefficient, so I decided I would try using a third party library to handle the image processing parts. Because I'm using TDD, I wanted to fi...

Possible reasons for FileStream.Write() to throw an OutOfMemoryException?

I have 10 threads writing thousands of small buffers (16-30 bytes each) to a huge file in random positions. Some of the threads throw OutOfMemoryException on FileStream.Write() opreation. What is causing the OutOfMemoryException ? What to look for? I'm using the FileStream like this (for every written item - this code runs from 10 dif...

How do I use large bitmaps in .NET?

Hello! I'm trying to write a light-weight image viewing application. However, there are system memory limitations with .NET. When trying to load large bitmaps (9000 x 9000 px or larger, 24-bit), I get a System.OutOfMemoryException. This is on a Windows 2000 PC with 2GB of RAM (of which 1.3GB is used up). It also takes a lot of time to ...

OutOfMemoryException On Mobile Device

I'm developing an application that uses a mobile device to take a photo and send it using a webservice. But after I've taken 4 photos I am getting an OutOfMemoryException in the code below. I tried calling GC.Collect() but it didn't help either. Maybe someone here could be give me an advice how to handle this problem. public static Bitm...

How to serialize big objects in .NET? (OutOfMemory Exceptions)

I'm using serialization for "save" feature in my application. But when the data is too big (15+ MB) I'm starting to get OutOfMemory exceptions. I've got so many objects and they are connected with other little objects, I think this is causing too much processing power and data held in the memory. My code is based on this, almost same: ...

OutOfMemoryException in Regex Matches when processing large files

I've got an exception log from one of production code releases. System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at System.Text.RegularExpressions.Match..ctor(Regex regex, Int32 capcount, String text, Int32 begpos, Int32 len, Int32 startpos) at System.Text.RegularExpressions.RegexRunner.Init...

How to trap the OutOfMemoryException in .NET (Excel add-in)

I am getting OutOfMemory Exception in my .net addin. The addin is using large number of managed and unmanaged objects. Is there a way to trap this exception? Updated: I think any application can get an OutofMemory exception if it processess a large amount of data that needs to be processed and not freed periodically. Suppose I have a me...

What's your experience with adding SSL to Tomcat 6?

Over the weekend we added SSL security to a Tomcat 6 instance that has been running for awhile without error. This morning, after the number of sessions increased on the machine, Tomcat began throwing 500 errors to users. I checked the logs and found an instance of OutOfMemory, followed by dozens of errors related to Google Guice attem...

.NET System.OutOfMemoryException on String.Split() of 120 MB CSV file

I am using C# to read a ~120 MB plain-text CSV file. Initially I did the parsing by reading it line-by-line, but recently determined that reading the entire file contents into memory first was multiple times faster. The parsing is already quite slow because the CSV has commas embedded inside quotes, which means I have to use a regex spli...

How to make a .NET process run out of memory without exhausting all system memory.

The problem is simple I have a process, that does ETL on some xml files. We started getting really large xml files and I started getting OutOfMemoryExceptions. Fixing the process is relatively simple. However, I'd like to make a unit test for my NUnit suite to make sure the process will continue to be able to handle really large files. ...

GDI+ DashStyle throws OutOfMemoryException in .NET

I'm using DashStyle.Dash while rendering my hierarchy of objects. My application uses Graphics.Transform extensively and I find that at some scale values (including a scale of 100%) and some angles of rotation, Graphics.DrawLine throws OutOfMemoryException when using a pen with DashStyle.Dash. Using Google I found that this is a well-kno...

ImageList / Image OutOfMemoryException

I'm suffering from an OutOfMemoryException when obtaining an Image from an ImageList I've been unable to find an appropriate solution to the problem. I've got a Custom ListView control, which has attached to it an Event for the drawing of ListViewItems. This then calls a static method which is designed to draw the item. For a ListView ...

System.Security.Policy.Evidence, Web Services and Blowing Out the LoH

A new application that has been developed has a heavy use of web services. We started hitting out of memory exceptions on a regular basis (as usage has increased). Upon reviewing the memory dumps I noticed there were a large number of same sized byte[]. Looking at the handles for these byte[] I noticed that they were referenced by System...

C#: Why do I get an OutOfMemoryException on a NullReferenceException?

I got an OutOfMemoryException earlier and couldn't figure out what it was for. It made no sense at all. Dug around in my code, and suddenly remembered that somewhere had forgotten to check for null, and in this particular case it was (and should be) exactly that. That shouldn't cause an OutOfMemoryException in my opinion, but I fixed it ...

Does a 32bit process need more memory when it runs on a 64bit system?

I have a rather memory hungry java application. On my 32 bit systems with Windows XP Professional the application will just run fine if I give it -Xmx1280m. Everything below will end up in an java.lang.OutOfMemoryError: Java heap space exception. If I run the same application on a 64 bit Windows XP Professional (everything else exactly ...

Vista, Visual Studio and OutOfMemoryExceptions

I'm having a bit of a problem where VS won't build because I get OutOfMemoryExceptions. My Vista box with 2 GIG RAM, is using about 1 Gig of RAM when it starts up, and I am not even doing anything (just connecting to the network drives at work etc) When I then run Visual Studio devenv.exe peaks at around 730MB after a few builds, and I ...