JNI can't release memory

前端 未结 1 770
无人共我
无人共我 2021-01-22 17:30

This is JNI\'s C++ code:

extern \"C\" JNIEXPORT jbyteArray JNICALL
Java_cn_rilled_encoder_JNIEncoder_encodeEncryptBuff(
        JNIEnv* env,
        jobject obj,         


        
相关标签:
1条回答
  • 2021-01-22 17:48

    I solved the problem with delete encryptBuff.

    New Code

    ...
    unsigned char* chars = (unsigned char *) malloc(chars_len);
    ...
    free(chars);
    delete encryptBuff;
    
    return bArray;
    

    New memory usage:

    0 讨论(0)
提交回复
热议问题