Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8667095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:53:14+00:00 2026-06-12T17:53:14+00:00

I copied a multidimensional array from java, but i am having some problems to

  • 0

I copied a multidimensional array from java, but i am having some problems to free the memory after using it.

what i did is:

jfieldID h_valID = (*env)->GetFieldID(env, h_cls, "val", "[[I");
jobjectArray h_val_obj = (*env)->GetObjectField(env, h, h_valID);
int h_val_local[xdim][ydim];
for(i=0; i<xdim; i++)
{
    h_val_one_dim = (jintArray) (*env)->GetObjectArrayElement(env, h_val_obj, i);
    h_val_elem = (*env)->GetIntArrayElements(env, h_val_one_dim, 0);
    for(j=0; j<ydim; j++)
    {
        h_val_local[i][j] = h_val_elem[j];
    }
    (*env)->ReleaseIntArrayElements(env, h_val_one_dim, h_val_elem, 0);
    (*env)->DeleteLocalRef(env, h_val_one_dim);
}
(*env)->DeleteLocalRef(env, h_val_obj);

I have 4 more arrays on that method, all on the parameters, i’m getting the pointer then releasing after using it.

int *x = (*env)->GetIntArrayElements(env,x_p,0);
int *y = (*env)->GetIntArrayElements(env,y_p,0);
int *v = (*env)->GetIntArrayElements(env,v_p,0);
int *w = (*env)->GetIntArrayElements(env,w_p,0);

…

(*env)->ReleaseIntArrayElements(env, x_p, x, 0);
(*env)->ReleaseIntArrayElements(env, y_p, y, 0);
(*env)->ReleaseIntArrayElements(env, v_p, v, 0);
(*env)->ReleaseIntArrayElements(env, w_p, w, 0);

For bigger files, i’m getting overflow on the reference table. What i’m forgetting to free or how do i fix this?

Log:

10-02 14:18:58.885: W/dalvikvm(23598): ReferenceTable overflow (max=1024)

10-02 14:18:58.885: W/dalvikvm(23598): Last 10 entries in JNI pinned array reference table:

10-02 14:18:58.885: W/dalvikvm(23598): 1014: 0x46109fe8 cls=[I (24 bytes)

10-02 14:18:58.885: W/dalvikvm(23598): 1015: 0x4610a008 cls=[I (24 bytes)

10-02 14:18:58.885: W/dalvikvm(23598): 1016: 0x46109fa8 cls=[I (24 bytes)

10-02 14:18:58.885: W/dalvikvm(23598): 1017: 0x46109fc8 cls=[I (24 bytes)

10-02 14:18:58.885: W/dalvikvm(23598): 1018: 0x46109fe8 cls=[I (24 bytes)

10-02 14:18:58.885: W/dalvikvm(23598): 1019: 0x4610a008 cls=[I (24 bytes)

10-02 14:18:58.885: W/dalvikvm(23598): 1020: 0x46109fa8 cls=[I (24 bytes)

10-02 14:18:58.885: W/dalvikvm(23598): 1021: 0x46109fc8 cls=[I (24 bytes)

10-02 14:18:58.885: W/dalvikvm(23598): 1022: 0x46109fe8 cls=[I (24 bytes)

10-02 14:18:58.885: W/dalvikvm(23598): 1023: 0x4610a008 cls=[I (24 bytes)

10-02 14:18:58.885: W/dalvikvm(23598): JNI pinned array reference table summary (1024 entries):

10-02 14:18:58.885: W/dalvikvm(23598): 1024 of [I 24B (4 unique)

10-02 14:18:58.885: W/dalvikvm(23598): Memory held directly by tracked refs is 96 bytes

10-02 14:18:58.885: E/dalvikvm(23598): Failed adding to JNI pinned array ref table (1024 entries)

thx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:53:15+00:00Added an answer on June 12, 2026 at 5:53 pm

    I found out what i was doing wrong, better, what i forgot to do. I have another return point in the code, but i forgot to release the arrays before returning in that case, i was only releasing it at the end of the function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I copied this code from another StackOverflow post. However, I am having some issues
I copied a table from the database and paste in excel-2003 . But some
I copied clang_complete.vim to plugin, but when I typed . after some variable, it
This code is copied directly from http://java.sun.com/docs/books/jni/html/objtypes.html#4013 JNIEXPORT jstring JNICALL Java_Prompt_getLine(JNIEnv *env, jobject obj,
I have copied some files across from one project to another. The code simply
I copied this example from perldoc -f sort . I added the @old array
I copied some PHP mailer and at some point had it working. But the
Copied the emma.jar to $JAVA_HOME/lib/ext & instrumented it using the following command. java -cp
I copied the following example from an SQLite Java library website: PreparedStatement prep =
I just copied an example from AndEngine main page, but the app is always

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.