I am wrapping an internal set of libraries written in C++ to provide access to an API in Java and I haven’t run into any issues until now.
I have a struct that is wrapped into a Java proxy class with its associated getters and setters. The generated code actually does work for some time. However, after enough calls to the getters in Java a segmentation fault occurs and the JVM to crashes. I am calling the getters in a for-each loop. For example:
for( NativeProxyClass t : ContainerOfNativeProxyClasses )
if( t.getSomeField() == 1 ) /// Segfault occurs in the native code corresponding with this getter only sometimes.
/// Do something with t.
I know this may be vague, but I cannot post the exact code. Like I said this is a strange issue because it does not always occur after a fixed amount of time, sometimes it takes a few seconds, sometimes it happens instantly. I don’t believe the object is being deleted because I’ve added print statements to the finalizer\delete function of the proxy class.
Your help is appreciated.