Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Question on PushLocalFrame / EnsureLocalCapacity  RSS feed

Dan Bizman
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a number of c++ functions that are called by the native method (i.e. the C++ function "JNI_CALL someClass_someMethod...") and have a large number of local refs created. So in each I have to call EnsureLocalCapacity and PushLocalFrame to make sure there's enough "space" for everything (can't call DeleteLocalRef because all the objects will be needed at the same time).

Since this EnsureLocal/PushLocal code (including error checks) is repeated in all these methods, I'd like to make a function that handles all that, e.g. ensureAndPush(int requiredCapacity). However, if I'm understanding it correctly, the calls will then only increase the local capacity within the "ensureCapacity" function and not in the functions that call it. Is this correct?

[ April 08, 2008: Message edited by: Dan Bizman ]
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!