JavaCake
JavaCake

Reputation: 4115

StackOverflowError in Eclipse while running Java code

Lately i ran into some memory issues which i have been trying to solve the paste few days, but unfortunately without any luck!

I am running Mac OS X 10.6.8 / 8GB RAM (Should not be any allocation problems!)

Eclipse version is Helios.

java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)

My Java exception:

Exception in thread "main" java.lang.StackOverflowError

And my eclipse.ini:

-startup
../../../plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.0.v20100503
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
1G
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Xms256m
-Xmx512m
-XX:PermSize=1024m
-XX:MaxPermSize=1024M
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts

I have also tried to add "-Xmx1536m" to my VM arguments in Eclipse, but without any luck at all!

Thanks in advance.

Upvotes: 2

Views: 11836

Answers (2)

Balkrushna Patil
Balkrushna Patil

Reputation: 466

In Eclipse Right click on project follow below steps:

  • Run
  • Run Configurations
  • click on JRE tab
  • In VM arguments section write below parameters -Xss2g

By default stack memory size is 512 KB. We can increase as per our need.

  • Click on apply and run project..

If in case any query, revert comment in comment sections.

Upvotes: 0

Adel Boutros
Adel Boutros

Reputation: 10295

StackOverflowError is a common error when you have an infinite recursive call such as :

void method(int a) {
    method(a);
}

this kind of calls will lead to the StackOverflowError.

So you should check in your code if you have this type of infinite recursive calls or maybe an endless loop.

Upvotes: 1

Related Questions