Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JNI Stack Problem

Reply
Thread Tools

JNI Stack Problem

 
 
DAnny K
Guest
Posts: n/a
 
      04-05-2005
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

 
Reply With Quote
 
 
 
 
Gordon Beaton
Guest
Posts: n/a
 
      04-05-2005
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
 
Reply With Quote
 
 
 
 
Vitaly
Guest
Posts: n/a
 
      04-05-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C/C++ compilers have one stack for local variables and return addresses and then another stack for array allocations on the stack. Casey Hawthorne C Programming 3 11-01-2009 08:23 PM
Re: JNI: Error loading DLL from JNI DDL vasanth Java 0 01-25-2005 11:03 AM
Re: JNI: Error loading DLL from JNI DDL vasanth Java 0 01-25-2005 11:01 AM
Porting JNI Windows under JNI LINUX + Wine ? Pasturel Jean-Louis Java 5 03-03-2004 07:50 PM
IBM's JNI fails where Sun's JNI works Alex Hunsley Java 4 11-04-2003 10:34 AM



Advertisments