outofmemoryexception

Why is my c# paint method running out of memory?

I'm new to c#, and trying to learn by writing some simple apps to get familiar with the syntax and .NET library. The most recent miniproject I took on is a polar clock like the one found here. One of the problems I noticed early on was that the app would constantly "flicker", which really took away from the presentation, so I read onli...

Groovy sql dataset causes java.lang.OutOfMemory

I have a table with 252759 tuples. I would like to use DataSet object to make my life easier, however when I try to create a DataSet for my table, after 3 seconds, I get java.lang.OutOfMemory. I have no experience with Datasets, are there any guidelines how to use DataSet object for big tables? ...

Rotating image causes outofmemory Exception

When I rotate an image on my the server. It causes an out of memory exception. /// <summary> /// Rotates the specified img. /// </summary> /// <param name="img">The img.</param> /// <param name="rotationAngle">The rotation angle.</param> /// <returns></returns> public static Bitmap Rotate(Image img, float ro...

Loading a resource to a mutable bitmap

I am loading a bitmap from a resource like so: Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image); What I want to do is make some changes to the bitmap before It gets drawn to the main canvas in my draw method (As it would seem wasteful to repeat lots of drawing in my main loop when it isn't going to change). I a...

How To Diagnose A System.OutOfMemoryException?

I ran some code last Friday before leaving work, and I'm here on Monday, and it stopped with an OutOfMemoryException. This entire process I estimate required making tens of billions of calculations, so it wasn't some small task. I don't even know how to begin fixing this. Any pointers? ...

Android handling out of memory exception on image processing

Hi all, This is the sequence part of this question: http://stackoverflow.com/questions/3674441/combining-2-images-overlayed so the problem is: if the image size is too big - it'll got an exception (out of memory exception) what i want is, to handle even if the handset got the lower spec hardware, it doesn't go to that exception (but it...

How to overcome OutOfMemoryError during huge file write

Hi, I am writing a full database extract program in java. Database is Oracle, and it is huge. Some tables have ~260 million records. The program should create one file per table in a specific format, so using Oracle datapump etc is not an option. Also, some company security policies do not allow to write a PL/SQL procedure to create fil...

OutOfMemoryException when creating huge string in ASP.NET

When exporting a lot of data to a string (csv format), I get a OutOfMemoryException. What's the best way to tackle this? The string is returned to a Flex Application. What I'd do is export the csv to the server disk and give back an url to Flex. Like this, I can flush the stream writing to the disk. Update: String is build with a Stri...

System.OutOfMemoryException thrown when computing date ranges

It might be a simple fix, but I can't for the life of me think of how to do this. I compute a bunch of StartDates and End Dates into a bunch of arrays of dates using this query: this.Reserved = unit.Reservations.Where(r => r.Active.HasValue && r.Active.Value).SelectMany(r => Utilities.DateRangeToArray(r.StartDate, r.EndDate)).ToArray();...

Problem with Runtime.freeMemory() - Java

Hey I'm testing out Runtime.freeMemory() with this code: Runtime runtime = Runtime.getRuntime(); long freeMemory = runtime.freeMemory(); // This is some arbitary factor that should work <= 1 double factor = 0.8; int size = (int) (factor * freeMemory); byte[] testArray = new byte[size]; I'm creating a byte array of size close t...

Pattern for working with process that may throw OutOfMemoryError

I have a Java client - server application. The client is designed to run arbitrary user code. If the user code running on the client creates an OutOfMemoryError then the client ends up in an ugly state. Normally the client would be sending messages (via RMI) to the server until the code the client is running terminates and the client gra...

how to catch OutOfMemoryError in JVM and run a script if it's caught?

Hi, I have a program that sometimes throw OOME, I understand that there is a flag in the JVM options that I can set and whenever a certain Error/Exception appears (such as OOME) it calls a script I wrote. The script will give the user a notification and will call a the program with a different argument so it won't get OOME again. does ...

hibernate's objects eating up jboss's jvm heap

hi folks, am seeing consistent Out of Memory Exceptions due to Hibernate objects consuming over 50% of the heap. (over 500M) Am using EntityManager for persistence PersitanceBag and Collection Entry are some of them and there are some HashMaps as well contributed by Hibernate. Please advise if there is any procedure to get rid of them...

64-bit OutOfMemoryException with SqlDataAdapter

The environment is: 64-bit Windows ~50GB RAM .NET 3.5 SP1 SQL 2008 The code is (essentially, from memory): System.Data.DataTable table = new System.Data.DataTable(); SqlCommand command = new SqlCommand("SELECT XmlColumn FROM Table WHERE ID = UniqueID", Connection); SqlDataAdapter adapter = new SqlDataAdapter(command); adapter.Fil...

Loading an image from a stream without keeping the stream open

Hello, Is it possible to use the FromStream method of System.Drawing.Image without having to keep the stream open for the lifetime of the image? I have an application which loads a bunch of toolbar graphics from resource files, using a combination of Image.FromStream and Assembly.GetManifestResourceStream. The problem I'm having is wh...

out of memory Image.FromFile

Why is it that I'm getting an out of memory error? Thank you if (File.Exists(photoURI)) { FileStream fs = new FileStream(photoURI, FileMode.Open, FileAccess.Read); Image img = Image.FromStream(fs); fs.Close(); } ...

RSA: java.lang.OutOfMemoryError

Hi folks, I am facing java.lang.OutOfMemoryError throwing from here : com.rsa.certj.cert.AttributeValueAssertion.clone Do you have any idea about that? ...

Hibernate: OOM-Exception, problem with IdentityMap?

Hi all, when loading lots of objects, I get a OOM-Exception. After analyzing the heap with a profiler, I see that there's a lot of memory in org/hibernate/util/IdentityMap which references a LinkedHashMap containing thousands of Entrys. What are those objects used for? I'm really thankful for all kinds of information... ...

exception:OutOfMemoryError: Java heap space when running the code

I have an application which forms all the possible pairs and then compare the pairs, but when I run the applicaion, it gave me exception:OutOfMemoryError:Java heap space when running the code. I tried -Xmx1500m, but the exception just kept coming. the code for generating the pairs are as following File file = ...; final Map<Pair, Colle...

how to reduce native heap usage in google map for android ?

Hi everyone, 10-15 14:43:43.020: ERROR/dalvikvm-heap(299): 32768-byte external allocation too large for this process. 10-15 14:43:43.020: ERROR/GraphicsJNI(299): VM won't let us allocate 32768 bytes 10-15 14:43:43.260: ERROR/AndroidRuntime(299): FATAL EXCEPTION: main 10-15 14:43:43.260: ERROR/AndroidRuntime(299): java.lang.OutOfMemo...