During initial stages of my coding the application that I programmed use to re-start due to Java Exception "java.lang.OutOfMemoryerror". After much analysis, we found that making frequent JNI function calls caused the java.lang.OutOfMemoryError.
Reason for the problem - JNI Memory Leak
The reference for any object created in Java and sent to JNI native functions were not de-referenced automatically. Since these objects were not de-referenced, they couldn't be cleared by GC which caused the memory leak.
Solution
Please refer following sample code to free the memory.
JNIEXPORT jobject JNICALL Java_sample_package_SampleJavaClass_classMethod
(JNIEnv * env, jobject obj, jstring jstrString)
{
const jchar* szString = (jchar*)env->GetStringChars(jstrString, 0);
env->ReleaseStringChars(jstrString, (const jchar *)szString);
// De-Referencing the String object
env->DeleteLocalRef(jstrString);
}
Results
Considerable amount of Memory Leaks were fixed. Throughput is not 100%.
Additional Reference:
http://www.dynamicobjects.com/d2r/archives/001816.html
great
ReplyDeleteI found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing..
ReplyDeleteBelieve me I did wrote an post about tutorials for beginners with reference of your blog.
Selenium training in bangalore
Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training
Thanks For Sharing The information The Information Shared Is Very Valuable Please Keep Updating us The Information shared Is Very Valuable Python Online Course Data Science Online Course Aws Online Course
ReplyDeleteNice Content
ReplyDeleteFor Data Science training in Bangalore, Visit:
Data Science training in Bangalore
Great content.Impressive article. Java training in Chennai | Certification | Online Course Training | Java training in Bangalore | Certification | Online Course Training | Java training in Hyderabad | Certification | Online Course Training | Java training in Coimbatore | Certification | Online Course Training | Java training in Online | Certification | Online Course Training
ReplyDeleteThankyou for the valuable content.It was really helpful in understanding the concept.# BOOST Your GOOGLE RANKING.It’s Your Time To Be On #1st Page
ReplyDeleteOur Motive is not just to create links but to get them indexed as will
Increase Domain Authority (DA).We’re on a mission to increase DA PA of your domain
High Quality Backlink Building Service
1000 Backlink at cheapest
50 High Quality for just 50 INR
2000 Backlink at cheapest
5000 Backlink at cheapest
Perde Modelleri
ReplyDeleteNumara Onay
MOBİL ÖDEME BOZDURMA
nft nasıl alınır
Ankara Evden Eve Nakliyat
trafik sigortası
dedektör
web sitesi kurma
Aşk kitapları
Manage yourself when concern. Office within trade style enjoy. Word dark environmental dinner admit.world-news
ReplyDelete