Throwing in the Towel on JNI

I previously stated that I didn’t think that JNI was so bad. I still feel that way, but I am having some strange issues that are very difficult to track down. I know the C++ code is good, I know the java code is good, but somehow something in between the two is wrong and it is crashing the JVM. It is really strange because control is back in the JVM when it crashes. The only way to make it work is to use the -Xms option to the JVM and set it to 128M which is ridiculuous.

I think this basically means that there is a memory leak someplace. I am going to ditch the JNI while I am still ahead and re-write the c++ stuff in java. I am taking several steps backwards by doing this, but if it leads to more reliable, undestandable and maintainable code in the long run then it is worth it. I had good reasons for writing the c++ code and utilizing JNI. Doing this stuff in pure java is going to be a PITA because java does not have a complex number class and does not allow operator overloading.

My fingers and eyes hurt just thinking about doing this, but I don’t really have any other options.

Leave a Reply

%d bloggers like this: