Results 1 to 4 of 4
- 07-04-2011, 01:59 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 5
- Rep Power
- 0
Getting exception java.lang.OutOfMemoryError: Can't allocate C string
I am using Java Nativ Access(JNA) calls to access C API. I have defined few few classes, extending com.sun.jna.Structure, correspondent to C structures defined in API.
I am able to make few calls using jna but it started throwing exception on one of the method.
with exception trace.
Exception in thread "main" java.lang.OutOfMemoryError: Can't allocate C string
at com.sun.jna.NativeLibrary.findSymbol(Native Method)
at com.sun.jna.NativeLibrary.getSymbolAddress(NativeL ibrary.java:380)
at com.sun.jna.Function.<init>(Function.java:176)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrar y.java:344)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrar y.java:324)
at com.sun.jna.Library$Handler.invoke(Library.java:20 3)
at $Proxy0.mcd_qry_devices_f(Unknown Source)
at com.kpit.mcd.jna.Main.main(Main.java:38)
I googled a lot but not finding the proper solution.
I increased heap memory and native method stack of JVM but had no luck.
Please reply me if you have any clue or suggestion.
-Sanjeev
- 07-05-2011, 03:29 AM #2
Try using a profiler to find if/where you have a memory leak.
- 07-05-2011, 03:43 PM #3
Member
- Join Date
- Jul 2011
- Posts
- 5
- Rep Power
- 0
Thanks for quick reply.
I used YourKit profiler for finding the memory leak. But I observed strange behaviour; when I run my application with profiler(attached profiler with VM) the out of memory error did not appear and it run without any issue. However, when I run the same application without profiler it is throwing same out of memory error.
It gives me the impression that profiler is some how(by setting some VM arguments) expanding the native memory area that's why it VM is not getting out of memory.Last edited by Sanjeev; 07-05-2011 at 03:45 PM. Reason: spell correction
- 07-05-2011, 06:18 PM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Similar Threads
-
PLease help. The error is: exception in thread "main" java.lang.OutOfMemoryError:Java
By Rasenganboy16 in forum New To JavaReplies: 2Last Post: 05-24-2011, 07:18 AM -
Error - Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap
By ganchinyong in forum AWT / SwingReplies: 4Last Post: 06-03-2010, 08:40 AM -
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
By vasavi.singh in forum Advanced JavaReplies: 10Last Post: 05-11-2009, 11:56 AM -
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
By Ms.Ranjan in forum New To JavaReplies: 3Last Post: 04-22-2009, 08:25 PM -
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
By Eku in forum NetBeansReplies: 14Last Post: 06-12-2008, 08:36 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks