outofmemoryexception

System.OutOfMemoryException being thrown

I am getting a system.outofmemory exception in my code: While r1.Read() menu1id = r1("id") db.AddInParameter(command2, "@menu1id", DbType.Int32, menu1id) r2 = db.ExecuteReader(command2) command2.Parameters.Clear() menu1heading = r1("Headi...

Refactoring - System.OutOfMemoryException

I'm getting an 'System.OutOfMemoryException' when trying to generate some HTML reports. How can I re-factor this so that the this is buffered to a file, instead of reading it all to memory, then written to a file. There are going to be upwards for 2000+ records in the datatable, and it's already running out of memory at 2000 rows. De...

Out of memory error while loading a Bitmap

Hello everybody, I'm working with big size images (for ex. 16000x9440 px) and cut some regions for other things. I'm getting an exception "Out of memory" when create a new Bitmap instance: using (FileStream fileStream = new FileStream(mapFileResized, FileMode.Open)) { byte[] data = new byte[fileStream.Length]; fileStream.Read(d...

OutOfMemory Exception while using FileBody for sending images to the server in Android?

Hi, I am using FileBody for sending images to the server from Android. But when sending bigger images the application crashes with OutOfMemory exception. Is there some way of overcoming this? Or has anyone faced the same problem with FileBody. Please help me out in this regard. Regards Sunil ...

How to list a 2 million files directory in java without having a out of memory exception

I have to deal with a directory of about 2 million xml's to be processed. I've already solved the processing distributing the work between machines and threads using queues and everything goes right. But now the big problem is the bottleneck of reading the directory with the 2 million files in order to fill the queues incrementally. ...

How to detect if loading an image will throw an OutOfMemory exception in .NET?

I have an application written using .NET 3.5 SP1 that downloads images from an external site and displays them to end users. On rare ocassions, my users are experiencing OutOfMemory errors because they are downloading enormous images. Sometimes the raw data associated with these images are large, but more often, the dimensions of the ima...

What's the easiest way to get an OutOfMemoryException in C#?

Just curious as to how I can get this error the easiest way. Once I was trying to create a file navigator and I was creating Image thumbnails; that turned out awful. ...

Would simple class instantiation ever fail in C#?

I saw some code written by another developer that looks something like this: var stringBuilder = new StringBuilder(); if(stringBuilder == null) { // Log memory allocation error // ... return; } (It is ALL over the place in the code ) Question 1: Would that error logging code even get called? If there was no memory, woul...

Android - A different Bitmap wallpaper for every home screen - OutOfMemory

I am trying to set a different wallpaper for every home screen, but I get OutOfMemory issues. I have 5 Bitmaps which I am trying to overlay on a wallpaper Bitmap which is 5 times the display width. Using the code below I get OOM. The problem seems to be the first line of code which creates the large wallpaper Bitmap. My question is wheth...

Tomcat OutOfMemoryError Java heap space Arrays.copyOf

We have an servlet that uploads files from customers and stores them on our server. Every few weeks the servlet fails with the following error: java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2882) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100) at java.la...

OutOfMemoryException when send big file 500MB using FileStream ASPNET

I'm using Filestream for read big file (> 500 MB) and I get the OutOfMemoryException. I use Asp.net , .net 3.5, win2003, iis 6.0 I want this in my app: Read DATA from Oracle Uncompress file using FileStream and BZip2 Read file uncompressed and send it to asp.net page for download. When I read file from disk, Fails !!! and get Ou...

OutOfMemory Exception when drawing cube

hi, i have a class that draws and rotates a cube. every time i rotate the cube i reload the buffer with the new values for the cube. public void LoadBuffer(GraphicsDevice graphicsDevice) { buffer = new VertexBuffer(graphicsDevice, VertexPositionNormalTexture.VertexDeclaration, triangles * 3, BufferUsage.None); bu...

OutOfMemoryException using BZip2 (SharpZipLib)

I use Asp.net , .net 3.5, win2003, iis 6.0. I use Oracle for gathering files, saving file in SharpZipLib.BZip2 compressed format in field RAW in table Oracle. My application is Web, and I use WCF Service for get data (array of bytes) of a file. The aspx page send file to user (download file). My issue-problem: I read DATA from Orac...

VS2008 Out of memory exception

every couple hours or so, when compiling my solution (fairly big one), i'm keep getting the following exception: C:\WINNT\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1353,9): error MSB4018: The "ResolveAssemblyReference" task failed unexpectedly. C:\WINNT\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1353,9): error MSB...

How to avoid OutOfMemoryException when running Hadoop?

Hi all! I'm running a Hadoop job over 1,5 TB of data with doing much pattern matching. I have several machines with 16GB RAM each, and I always get OutOfMemoryException on this job with this data (I'm using Hive). I would like to know how to optimally set option HADOOP_HEAPSIZE in file hadoop-env.sh so, my job would not fail. Is it eve...

System.OutOfMemoryException

I have a program written in asp.net with lucene.net. At first I create an index from 28000 documents. Secondly I'm executing a search, but sometimes there is an error. (I think this error is thrown when there are many results) The important part of code: Dim hits As Hits = searcher.Search(query) Dim results As Integer = hits.Length() ...

OutofMemoryException - Loading Extremely Large Images

I'm trying to load an extremely large image (14473x25684), but I'm hitting into a memory limitation. Here's a simple program to demonstrate the problem: static void Main(string[] args) { string largeimage = @"C:\Temp\test_image.jpg"; // 14473x25684 Image i = Bitmap.FromFile(largeimage); // OutofMemoryException was unhandled } ...

Getting GCOverhead Limit exceeded

Hi, The following code is throwing OutofMemoryError on Linux 3.5 enterprise box running jdk1.6.0_14 but running fine on JDK 1.6.0_20 I am clueless why its happening. while (rs.next()) { for (TableMetaData tabMeta : metaList) { rec.append(getFormattedString(rs, tabMeta)); } rec.append(lf); recCount++; if (recCount % maxRecBefor...

Android: Strange Out of Memory Exception

Hello, i have a problem with a strange out of memory exception that only occurs on some devices (mostly HTC Desire). It happens there every time a user starts a certain activity (no matter how - there are two paths to that activity) and i'm really puzzled as to why (i checked for leaks and couldn't find any)... The error is either thr...

Why does StreamReader.ReadLine throw OutOfMemoryException?

Can anyone tell me why the last line here throws OOM exception? byte[] buffer = new byte[1]; buffer[0] = 239; MemoryStream ms = new MemoryStream(buffer); StreamReader sr = new StreamReader(ms); string l1 = sr.ReadLine(); string l2 = sr.ReadLine(); ...