I am facing crash issue in native of my android code.
My app is similar to app described in this scenario (Click here).
Java layer will call the native layer by calling some native API and intiates some process.
Native call returns back immediately while launching a thread in the native for processing.
Once processing is completed, native thread will call the java function (call back function) for informing the result. This has been done by using JNI functions and making use of the *jvm->AttachCurrentThread().
What i observe from the stack trace dump in the log cat is, its not even completed the processing and it is crashing always at malloc or free (after some mallocs or after some frees and not consistent).
Is there anyway to find the memory corruption in native code of android?
As mentioned in the above link I tried with this solution by adding
LOCAL_EXPORT_LDLIBS += -lc
flag in the android.mk file. But it was not helpful, still I am able to observe the crashes.
Please let me know if anyone knows solution for the same.
P.S: The code which I am using for native processing is completely tested for the other product (Which is not on android). Facing problems when trying to port to android.
Thanks & Regards,
SSuman185
I found the problem, actually memset() was being done after freeing the memory. Astonishing thing is, this code was already released and working fine for other platform. But it is giving crashes in Android.