G
George Karabotsos
Hey guys,
I have a question pertinent to how deep I can go with Java as compared
with C and whether there is any way to match or at least closely
approximate the C depth.
For illustration purposes I have written 2 small programs, which are
attached, one is java the other one is in C.
The environment I run these two programs is as follows:
i686 i686 i386 GNU/Linux
filesize unlimited
datasize unlimited
stacksize unlimited
coredumpsize 0 kbytes
memoryuse unlimited
vmemoryuse unlimited
descriptors 1024
memorylocked 32 kbytes
maxproc 16360
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--host=i386-redhat-linux
Thread model: posix
gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
Ok now to the actual results and question.
With C I am able to go throught the program with no issues. On the
other hand Java throws StackOverflowError at after DoIt is been called
recursively 84K times or so.
82000
83000
84000
Exception in thread "main" java.lang.StackOverflowError
Is there any way I can get java to come close to C's results?
I tried using the -Xms, -Xmx, and -Xss flags but the results did not
changed by much. When tried the same program in SunOS things improved
but I had to allocate a huge stack to make it work.
Thank you in advance,
George
I have a question pertinent to how deep I can go with Java as compared
with C and whether there is any way to match or at least closely
approximate the C depth.
For illustration purposes I have written 2 small programs, which are
attached, one is java the other one is in C.
The environment I run these two programs is as follows:
Linux xxxxxxx 2.6.14-1.1644_FC4smp #1 SMP Sun Nov 27 03:39:31 EST 2005uname -a
i686 i686 i386 GNU/Linux
cputime unlimitedlimit
filesize unlimited
datasize unlimited
stacksize unlimited
coredumpsize 0 kbytes
memoryuse unlimited
vmemoryuse unlimited
descriptors 1024
memorylocked 32 kbytes
maxproc 16360
Using built-in specs.gcc -v
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--host=i386-redhat-linux
Thread model: posix
gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)
java version "1.5.0_06"/pkg/jdk1.5/bin/java -version
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
Ok now to the actual results and question.
With C I am able to go throught the program with no issues. On the
other hand Java throws StackOverflowError at after DoIt is been called
recursively 84K times or so.
82000
83000
84000
Exception in thread "main" java.lang.StackOverflowError
Is there any way I can get java to come close to C's results?
I tried using the -Xms, -Xmx, and -Xss flags but the results did not
changed by much. When tried the same program in SunOS things improved
but I had to allocate a huge stack to make it work.
Thank you in advance,
George