JNI memory leaks local reference table overflow (max=512)

Source: Internet
Author: User
01-02 00:02:35.064:E/DALVIKVM (4223): JNI ERROR (App bug): Local reference table overflow (max=512)

This error can be caused by a large amount of data being passed to JNI, or when a large number of objects are new, if not released in time.

1. After converting Java string to native string, the Releasestringutfchars release is invoked.

if (mnull!= pszpath && mnull!= strjstring)
{
Env->releasestringutfchars (strjstring, Pszpath);
}

2. Call (env)->deletelocalref (obj) after using the Java pass-through obj;

Resources:

Http://stackoverflow.com/questions/4174453/android-native-process-provoke-referencetable-overflow-after-a-while-android-n

Http://stackoverflow.com/questions/9372373/referencetable-overflow-max-512-jni


Original link: http://www.cnblogs.com/androidwsjisji/archive/2012/05/11/2495399.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.