Topic
  • 1 reply
  • Latest Post - ‏2012-09-01T05:13:00Z by SystemAdmin
nutmegmp
nutmegmp
8 Posts

Pinned topic What is -Xmso and -Xss

‏2012-08-31T14:27:14Z |
All:

I have a java application which uses JNI. We are suspecting either stack overflow or heap corruption. I am trying to isolate the problem. The failures show various stack traces.

Our application has Java thread which call JNI code which in turn calls other "C" libraries. In this scenario, what are the effect of the following options?

"-Xmso<size>
Sets the initial stack size for operating system threads. The default value can be determined by running the command:
java -verbose:sizes
The maximum value for the stack size varies according to platform and specific machine configuration. If you exceed the maximum value, a java/lang/OutOfMemoryError message is reported."
"-Xss<size>
Sets the maximum stack size for Java threads. The default is 256 KB for 32-bit JVMs and 512 KB for 64-bit JVMs. The maximum value varies according to platform and specific machine configuration. If you exceed the maximum value, a java/lang/OutOfMemoryError message is reported."

  • My understanding is that -Xss controls the Java thread stack size including JNI calls. Is this correct?
  • What does -Xmso influence? What are operating system threads in this context?

I will appreciate any help or resource pointers.
Updated on 2012-09-01T05:13:00Z at 2012-09-01T05:13:00Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    2736 Posts

    Re: What is -Xmso and -Xss

    ‏2012-09-01T05:13:00Z  
    Java thread is implemented by native thread of the operating System. By using Xmso, we can control the size of the native thread stack size.
    For example,

    A.java
    class A{
    public native void foo();

    public foo_caller() {
    foo();
    }
    }

    foo.so
    JNI void foo()
    {
    printf(....);

    }
    if we execute above program,

    java stack frame will look like,

    foo
    foo_caller
    main <<<<<< Xss controls the size of the java stack

    & native stack will look like,

    printf <<<< also if printf invokes if any other native library functions, those will be created in native stack.
    foo_caller
    & frame equivalent to java call <<<<<< Xmso controls the size of the native stack