Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

NewByteArray / how to free it?

843829May 31 2005 — edited Jun 1 2005
Hi,

Let's say I have a native method called package.foo().

package.foo() needs to call a java method and give it an array. It does not return the array.

void foo() {
jbytearray jdata = env->NewByteArray(ARRAY_SIZE);
// put data in array here

// now call native method
jenv->CallVoidMethod(blah,blah,jdata,0,ARRAY_SIZE);

}

Now, I can't really rewrite it to just return the array. So, what do i do with jdata when I'm done? do I call deleteLocal/GlobalRef() on it? leave it alone?

thanks,

--buddy

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 29 2005
Added on May 31 2005
4 comments
14,903 views