JNI Stack Problem

Discussion in 'Java' started by DAnny K, Apr 5, 2005.

  1. DAnny K

    DAnny K Guest

    Hi, I have a problem with the JNI in that I am trying to run some C
    code using a Java GUI. The problem is is that I create some v large
    arrays in my c code that the JVM apparenty cant deal with. - arrays of
    say 50,000 elements. I have tried to increase the stack size using the
    -Xss argument, but it still gives me this error

    An unrecoverable stack overflow has occurred.
    #
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #
    # EXCEPTION_STACK_OVERFLOW (0xc00000fd) at pc=0x00971ee7, pid=3784,
    tid=2740
    #
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_02-b09 mixed mode)
    # Problematic frame:
    # C [freqLib.dll+0x1ee7]
    #
    # An error report file with more information is saved as
    hs_err_pid3784.log
    #
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    #

    Ta for any help in advance
     
    DAnny K, Apr 5, 2005
    #1
    1. Advertising

  2. On 5 Apr 2005 05:57:53 -0700, DAnny K wrote:
    > Hi, I have a problem with the JNI in that I am trying to run some C
    > code using a Java GUI. The problem is is that I create some v large
    > arrays in my c code that the JVM apparenty cant deal with. - arrays
    > of say 50,000 elements. I have tried to increase the stack size
    > using the -Xss argument, but it still gives me this error
    >
    > An unrecoverable stack overflow has occurred.


    The solution is simple: don't create objects of that size on the
    stack. Instead, use malloc() or one of its friends to dynamically
    allocate the array. Don't forget to free() it afterwards.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
     
    Gordon Beaton, Apr 5, 2005
    #2
    1. Advertising

  3. DAnny K

    Vitaly Guest

    The best solution is not using of Stack and Local Heap memory in jni. As
    these are used by JVM. In MS Windows (if it possible) I use Global Heap or
    Virtual Memory in my JNI code.

    "DAnny K" <> wrote in message
    news:...
    > Hi, I have a problem with the JNI in that I am trying to run some C
    > code using a Java GUI. The problem is is that I create some v large
    > arrays in my c code that the JVM apparenty cant deal with. - arrays of
    > say 50,000 elements. I have tried to increase the stack size using the
    > -Xss argument, but it still gives me this error
    >
    > An unrecoverable stack overflow has occurred.
    > #
    > # An unexpected error has been detected by HotSpot Virtual Machine:
    > #
    > # EXCEPTION_STACK_OVERFLOW (0xc00000fd) at pc=0x00971ee7, pid=3784,
    > tid=2740
    > #
    > # Java VM: Java HotSpot(TM) Client VM (1.5.0_02-b09 mixed mode)
    > # Problematic frame:
    > # C [freqLib.dll+0x1ee7]
    > #
    > # An error report file with more information is saved as
    > hs_err_pid3784.log
    > #
    > # If you would like to submit a bug report, please visit:
    > # http://java.sun.com/webapps/bugreport/crash.jsp
    > #
    >
    > Ta for any help in advance
    >
     
    Vitaly, Apr 5, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley

    IBM's JNI fails where Sun's JNI works

    Alex Hunsley, Nov 3, 2003, in forum: Java
    Replies:
    4
    Views:
    879
    Alex Hunsley
    Nov 4, 2003
  2. Pasturel Jean-Louis

    Porting JNI Windows under JNI LINUX + Wine ?

    Pasturel Jean-Louis, Feb 29, 2004, in forum: Java
    Replies:
    5
    Views:
    943
    Pasturel Jean-Louis
    Mar 3, 2004
  3. vasanth
    Replies:
    0
    Views:
    2,780
    vasanth
    Jan 25, 2005
  4. vasanth
    Replies:
    0
    Views:
    638
    vasanth
    Jan 25, 2005
  5. bgabrhelik
    Replies:
    0
    Views:
    888
    bgabrhelik
    Sep 29, 2009
Loading...

Share This Page