Home > Archive > Java Help > May 2004 > JNI DLL out of memory?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
JNI DLL out of memory?
|
|
| Mikael Laine 2004-05-16, 11:32 am |
| Hi all, and thanks for reading this msg.
My problem is as follows: I have a dll with some native methods that I
want to use from my JAVA-app, but allocating too big arrays results in
"An unrecoverable stack overflow has occurred."
The entire error message is lower in this message.
The piece of code I use here is essentially (I call a native method from
java that calls this):
void testbsearch(){int testarray[500000];}
How do I know it runs out of memory? Simple, because
void testbsearch(){int testarray[50000];}
works just fine, no errors. A size of 75000 didn't work either, so the
boundary is somewhere in between 50k and 75k = 100KB and 150KB of memory.
SO, MY QUESTION IS: HOW DO I GIVE MORE MEMORY TO MY DLL?
(btw. allocating big arrays in JAVA has worked just fine to a certain
limit. I tried an integer array of size 20000000 with no probs. Thats
about 40Megs of RAM used. The problem isn't with VM memory limits, then...)
The entire error message is here:
------------------------------------------------------------------------------------------
An unrecoverable stack overflow has occurred.
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_STACK_OVERFLOW (0xc00000fd) occurred at
PC=0x5572447
Function=[Unknown.]
Library=C:\eclipse\workspace\OCRBench\Re
cognizerNeuralOne.dll
NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for possible
reason and solutions.
Current Java thread:
at RecognizerNeuralOne.startprocess(Native Method)
at RecognizerNeuralOne.start(RecognizerNeuralOne.java:7)
at
CharacterRecognitionTestBench. doOperation(CharacterRecognitionTestBenc
h.java:171)
at
CharacterRecognitionTestBench. actionPerformed(CharacterRecognitionTest
Bench.java:212)
at java.awt.Button.processActionEvent(Button.java:382)
at java.awt.Button.processEvent(Button.java:350)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at
java.awt.EventDispatchThread. pumpOneEventForHierarchy(EventDispatchTh
read.java:201)
at
java.awt.EventDispatchThread. pumpEventsForHierarchy(EventDispatchThre
ad.java:151)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Dynamic libraries:
0x00400000 - 0x00406000 C:\j2sdk1.4.2_03\bin\java.exe
0x77F50000 - 0x77FF7000 C:\WINDOWS\System32\ntdll.dll
0x77E60000 - 0x77F46000 C:\WINDOWS\system32\kernel32.dll
0x77DC0000 - 0x77E5C000 C:\WINDOWS\system32\ADVAPI32.dll
0x78000000 - 0x78087000 C:\WINDOWS\system32\RPCRT4.dll
0x77C00000 - 0x77C53000 C:\WINDOWS\system32\MSVCRT.dll
0x08000000 - 0x08138000 C:\j2sdk1.4.2_03\jre\bin\client\jvm.dll
0x77D30000 - 0x77DBC000 C:\WINDOWS\system32\USER32.dll
0x7E190000 - 0x7E1D1000 C:\WINDOWS\system32\GDI32.dll
0x76B30000 - 0x76B5C000 C:\WINDOWS\System32\WINMM.dll
0x76370000 - 0x7638C000 C:\WINDOWS\System32\IMM32.DLL
0x62F30000 - 0x62F38000 C:\WINDOWS\System32\LPK.DLL
0x72F70000 - 0x72FCA000 C:\WINDOWS\System32\USP10.dll
0x10000000 - 0x10007000 C:\j2sdk1.4.2_03\jre\bin\hpi.dll
0x003F0000 - 0x003FE000 C:\j2sdk1.4.2_03\jre\bin\verify.dll
0x008A0000 - 0x008B9000 C:\j2sdk1.4.2_03\jre\bin\java.dll
0x008C0000 - 0x008CD000 C:\j2sdk1.4.2_03\jre\bin\zip.dll
0x02CB0000 - 0x02DBF000 C:\j2sdk1.4.2_03\jre\bin\awt.dll
0x72FD0000 - 0x72FF3000 C:\WINDOWS\System32\WINSPOOL.DRV
0x7CCC0000 - 0x7CDE4000 C:\WINDOWS\system32\ole32.dll
0x02FD0000 - 0x03020000 C:\j2sdk1.4.2_03\jre\bin\fontmanager.dll
0x51000000 - 0x51047000 C:\WINDOWS\System32\ddraw.dll
0x73B90000 - 0x73B96000 C:\WINDOWS\System32\DCIMAN32.dll
0x5C000000 - 0x5C0C8000 C:\WINDOWS\System32\D3DIM700.DLL
0x746F0000 - 0x74734000 C:\WINDOWS\System32\MSCTF.dll
0x63000000 - 0x63014000 C:\WINDOWS\System32\SynTPFcs.dll
0x77BF0000 - 0x77BF7000 C:\WINDOWS\system32\VERSION.dll
0x05520000 - 0x05527000 C:\Program
Files\Logitech\MouseWare\System\LgWndHk.dll
0x05540000 - 0x0556B000 C:\WINDOWS\System32\msctfime.ime
0x05570000 - 0x05910000
C:\eclipse\workspace\OCRBench\Recognizer
NeuralOne.dll
0x05AB0000 - 0x05ABB000 C:\Program Files\Common
Files\Logitech\Scrolling\LgMsgHk.dll
0x76060000 - 0x760C1000 C:\WINDOWS\System32\MSVCP60.dll
0x74E00000 - 0x74E6A000 C:\WINDOWS\System32\RICHED20.DLL
0x76C80000 - 0x76CA2000 C:\WINDOWS\system32\imagehlp.dll
0x6DAB0000 - 0x6DB2D000 C:\WINDOWS\system32\DBGHELP.dll
0x76BE0000 - 0x76BEB000 C:\WINDOWS\System32\PSAPI.DLL
Heap at VM Abort:
Heap
def new generation total 576K, used 172K [0x10010000, 0x100b0000,
0x104f0000)
eden space 512K, 21% used [0x10010000, 0x1002b3c8, 0x10090000)
from space 64K, 100% used [0x10090000, 0x100a0000, 0x100a0000)
to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000)
tenured generation total 1408K, used 228K [0x104f0000, 0x10650000,
0x14010000)
the space 1408K, 16% used [0x104f0000, 0x105292e8, 0x10529400,
0x10650000)
compacting perm gen total 4096K, used 2823K [0x14010000, 0x14410000,
0x18010000)
the space 4096K, 68% used [0x14010000, 0x142d1e58, 0x142d2000,
0x14410000)
Local Time = Sun May 16 17:37:12 2004
Elapsed Time = 2
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_03-b02 mixed mode)
#
# An error report file has been saved as hs_err_pid648.log.
# Please refer to the file for further information.
#
| |
| Roedy Green 2004-05-16, 2:31 pm |
| On Sun, 16 May 2004 17:48:39 +0300, Mikael Laine <mialain@utu.fi>
wrote or quoted :
>SO, MY QUESTION IS: HOW DO I GIVE MORE MEMORY TO MY DLL?
That's a question to pose to the maker of your linker/compiler of the
C/C++ part. Dig around in the project settings.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
| |
| Gordon Beaton 2004-05-17, 3:31 am |
| On Sun, 16 May 2004 17:48:39 +0300, Mikael Laine wrote:
> The piece of code I use here is essentially (I call a native method
> from java that calls this):
>
> void testbsearch(){int testarray[500000];}
>
> How do I know it runs out of memory? Simple, because
>
> void testbsearch(){int testarray[50000];}
>
> works just fine, no errors. A size of 75000 didn't work either, so
> the boundary is somewhere in between 50k and 75k = 100KB and 150KB
> of memory.
>
> SO, MY QUESTION IS: HOW DO I GIVE MORE MEMORY TO MY DLL?
Don't shout.
You are running into this limit because you are attempting to
statically allocate too much memory. Allocate the array dynamically
instead using malloc() or calloc() and you'll find that the limit is
much higher.
/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
| |
|
| gets back to the limitations of C++ not Java. looks like you've overrun
your static memory limits, switch to dynamic memory allocation and
besure to free it up when you are finished.
have you read "Essential JNI" by mr. Gordon ?
- perry
Mikael Laine wrote:
> Hi all, and thanks for reading this msg.
> My problem is as follows: I have a dll with some native methods that I
> want to use from my JAVA-app, but allocating too big arrays results in
> "An unrecoverable stack overflow has occurred."
> The entire error message is lower in this message.
> The piece of code I use here is essentially (I call a native method from
> java that calls this):
>
> void testbsearch(){int testarray[500000];}
>
> How do I know it runs out of memory? Simple, because
>
> void testbsearch(){int testarray[50000];}
>
> works just fine, no errors. A size of 75000 didn't work either, so the
> boundary is somewhere in between 50k and 75k = 100KB and 150KB of memory.
>
> SO, MY QUESTION IS: HOW DO I GIVE MORE MEMORY TO MY DLL?
> (btw. allocating big arrays in JAVA has worked just fine to a certain
> limit. I tried an integer array of size 20000000 with no probs. Thats
> about 40Megs of RAM used. The problem isn't with VM memory limits, then...)
>
> The entire error message is here:
> ------------------------------------------------------------------------------------------
>
> An unrecoverable stack overflow has occurred.
>
> An unexpected exception has been detected in native code outside the VM.
> Unexpected Signal : EXCEPTION_STACK_OVERFLOW (0xc00000fd) occurred at
> PC=0x5572447
> Function=[Unknown.]
> Library=C:\eclipse\workspace\OCRBench\Re
cognizerNeuralOne.dll
>
> NOTE: We are unable to locate the function name symbol for the error
> just occurred. Please refer to release documentation for possible
> reason and solutions.
>
>
> Current Java thread:
> at RecognizerNeuralOne.startprocess(Native Method)
> at RecognizerNeuralOne.start(RecognizerNeuralOne.java:7)
> at
> CharacterRecognitionTestBench. doOperation(CharacterRecognitionTestBenc
h.java:171)
>
> at
> CharacterRecognitionTestBench. actionPerformed(CharacterRecognitionTest
Bench.java:212)
>
> at java.awt.Button.processActionEvent(Button.java:382)
> at java.awt.Button.processEvent(Button.java:350)
> at java.awt.Component.dispatchEventImpl(Component.java:3615)
> at java.awt.Component.dispatchEvent(Component.java:3477)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
> at
> java.awt.EventDispatchThread. pumpOneEventForHierarchy(EventDispatchTh
read.java:201)
>
> at
> java.awt.EventDispatchThread. pumpEventsForHierarchy(EventDispatchThre
ad.java:151)
>
> at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
> at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
>
> Dynamic libraries:
> 0x00400000 - 0x00406000 C:\j2sdk1.4.2_03\bin\java.exe
> 0x77F50000 - 0x77FF7000 C:\WINDOWS\System32\ntdll.dll
> 0x77E60000 - 0x77F46000 C:\WINDOWS\system32\kernel32.dll
> 0x77DC0000 - 0x77E5C000 C:\WINDOWS\system32\ADVAPI32.dll
> 0x78000000 - 0x78087000 C:\WINDOWS\system32\RPCRT4.dll
> 0x77C00000 - 0x77C53000 C:\WINDOWS\system32\MSVCRT.dll
> 0x08000000 - 0x08138000 C:\j2sdk1.4.2_03\jre\bin\client\jvm.dll
> 0x77D30000 - 0x77DBC000 C:\WINDOWS\system32\USER32.dll
> 0x7E190000 - 0x7E1D1000 C:\WINDOWS\system32\GDI32.dll
> 0x76B30000 - 0x76B5C000 C:\WINDOWS\System32\WINMM.dll
> 0x76370000 - 0x7638C000 C:\WINDOWS\System32\IMM32.DLL
> 0x62F30000 - 0x62F38000 C:\WINDOWS\System32\LPK.DLL
> 0x72F70000 - 0x72FCA000 C:\WINDOWS\System32\USP10.dll
> 0x10000000 - 0x10007000 C:\j2sdk1.4.2_03\jre\bin\hpi.dll
> 0x003F0000 - 0x003FE000 C:\j2sdk1.4.2_03\jre\bin\verify.dll
> 0x008A0000 - 0x008B9000 C:\j2sdk1.4.2_03\jre\bin\java.dll
> 0x008C0000 - 0x008CD000 C:\j2sdk1.4.2_03\jre\bin\zip.dll
> 0x02CB0000 - 0x02DBF000 C:\j2sdk1.4.2_03\jre\bin\awt.dll
> 0x72FD0000 - 0x72FF3000 C:\WINDOWS\System32\WINSPOOL.DRV
> 0x7CCC0000 - 0x7CDE4000 C:\WINDOWS\system32\ole32.dll
> 0x02FD0000 - 0x03020000 C:\j2sdk1.4.2_03\jre\bin\fontmanager.dll
> 0x51000000 - 0x51047000 C:\WINDOWS\System32\ddraw.dll
> 0x73B90000 - 0x73B96000 C:\WINDOWS\System32\DCIMAN32.dll
> 0x5C000000 - 0x5C0C8000 C:\WINDOWS\System32\D3DIM700.DLL
> 0x746F0000 - 0x74734000 C:\WINDOWS\System32\MSCTF.dll
> 0x63000000 - 0x63014000 C:\WINDOWS\System32\SynTPFcs.dll
> 0x77BF0000 - 0x77BF7000 C:\WINDOWS\system32\VERSION.dll
> 0x05520000 - 0x05527000 C:\Program
> Files\Logitech\MouseWare\System\LgWndHk.dll
> 0x05540000 - 0x0556B000 C:\WINDOWS\System32\msctfime.ime
> 0x05570000 - 0x05910000
> C:\eclipse\workspace\OCRBench\Recognizer
NeuralOne.dll
> 0x05AB0000 - 0x05ABB000 C:\Program Files\Common
> Files\Logitech\Scrolling\LgMsgHk.dll
> 0x76060000 - 0x760C1000 C:\WINDOWS\System32\MSVCP60.dll
> 0x74E00000 - 0x74E6A000 C:\WINDOWS\System32\RICHED20.DLL
> 0x76C80000 - 0x76CA2000 C:\WINDOWS\system32\imagehlp.dll
> 0x6DAB0000 - 0x6DB2D000 C:\WINDOWS\system32\DBGHELP.dll
> 0x76BE0000 - 0x76BEB000 C:\WINDOWS\System32\PSAPI.DLL
>
> Heap at VM Abort:
> Heap
> def new generation total 576K, used 172K [0x10010000, 0x100b0000,
> 0x104f0000)
> eden space 512K, 21% used [0x10010000, 0x1002b3c8, 0x10090000)
> from space 64K, 100% used [0x10090000, 0x100a0000, 0x100a0000)
> to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000)
> tenured generation total 1408K, used 228K [0x104f0000, 0x10650000,
> 0x14010000)
> the space 1408K, 16% used [0x104f0000, 0x105292e8, 0x10529400,
> 0x10650000)
> compacting perm gen total 4096K, used 2823K [0x14010000, 0x14410000,
> 0x18010000)
> the space 4096K, 68% used [0x14010000, 0x142d1e58, 0x142d2000,
> 0x14410000)
>
> Local Time = Sun May 16 17:37:12 2004
> Elapsed Time = 2
> #
> # The exception above was detected in native code outside the VM
> #
> # Java VM: Java HotSpot(TM) Client VM (1.4.2_03-b02 mixed mode)
> #
> # An error report file has been saved as hs_err_pid648.log.
> # Please refer to the file for further information.
> #
>
|
|
|
|
|