hai friends,

Am developing java project with client server interaction,

am getting the Exception in thread "RMI TCP Connection(idle)"
java.lang.OutOfMemoryError: Java heap space

Exception, i doknow how to solve this ,please help me in this.

Recommended Answers

All 4 Replies

Without the code or the full details of the Exception we can only guess.
But in general an OutOfMemoryError happens because (a) you have a ginormous amount of data in memory or (b) your code is stuck in a loop creating the same objects over and over again (more likely)

There are several JVM options that will increase the heap and stack size of the vm. Besides finding out what is eating all the memory, as James pointed out, you can look at garbage collection stats (java -verbose:gc, which will show, at least, how often the GC is running. You can increase your java heap size with -Xms and -Xmx, -XX:MaxPermSize. You can increase the java stack size with -Xss. Research these parameters before willy-nilly applying them, and go through your code to determine why you are running out of heap space. If you are using an IDE and running your program within the IDE, that's one reason you can quickly run out of memory.

Thanks for your kind reply friends,

its occur because stucks in a loop

OK. Time to mark this thread "solved" please.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.