java.lang.OutOfMemoryError

Hi,

how can i get rid of java.lang.OutOfMemoryError....

Thank you

[84 byte] By [ismailsheikha] at [2007-11-27 10:49:10]
# 1

Stop keeping everything in memory?

Come on, really, there could be a half a million different reasons why you are getting this exception. More information is needed. Probably a lot more.

Edit: And if they are valid reasons, then simply try setting the memory higher (if you have the available memory) using -Xms and -Xmx flags.

Message was edited by:

masijade.

masijade.a at 2007-7-29 11:17:28 > top of Java-index,Java Essentials,Java Programming...
# 2

Thanks to your quick response..

Anyway, i am using ......java version "1.4.1_03"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.

Java HotSpot(TM) Client VM (build 1.4.1_03-b02, mixed mode)

I have develop a editor using JEditorpane. Here's I have put a Print Preview option. When lot of data in editor then this error occurs, others' s its run smoothly..

Thank you

ismailsheikha at 2007-7-29 11:17:28 > top of Java-index,Java Essentials,Java Programming...
# 3

Hi,

I am new to java. I don't know how setting the memory higher using -Xms and -Xmx flags . Could you please send me details, that i can do it...

Thank you

ismailsheikha at 2007-7-29 11:17:28 > top of Java-index,Java Essentials,Java Programming...
# 4

It doesn't sound like it ought to use a lot of memory. Check carefully that you aren't holding on to data you shouldn't.

To increase the memory, you need to add a flag on the java command (before the class name or -jar option). It looks like -Xmx256m (to set the max heap to 256MB).

malcolmmca at 2007-7-29 11:17:28 > top of Java-index,Java Essentials,Java Programming...
# 5

If your using WindowsXP, open up your IDE but dont run your application. Then on your keyboard, click <cntrl><alt><del><task master><performance> If it says you dont have enough memory, buy more memory for your computer. If you run your application and it says your out of memory, you have a bug in your code such as an infinite loop. If running your application still says' out of memory', I suggest as a solution a liberal use of black electrical tape to cover up the message.

George123a at 2007-7-29 11:17:28 > top of Java-index,Java Essentials,Java Programming...