× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scott Klement wrote:
> 
> Hi Barbara,
> 
> On Fri, 20 Jun 2003, Barbara Morris wrote:
> >
> >  beginObjGroup (env : 10000);  // guess the maximum number of objects
> >
> 
> I'm not sure if I have this correct or not, but this web page at Sun
> ( http://java.sun.com/docs/books/jni/html/refs.html ) seems to imply
> that the 10000 you used in your example is not a fixed-limit.
> 
> In fact, it says that if you do not call PushLocalFrame or
> EnsureLocalCapacity, the number defaults to 16!
> 
> If my program was running with only 16-preallocated, is there an advantage
> to preallocating 10000 objects?  Would it perform better?  Would that use
> up a lot of extra memory?
> 
> Or, am I just completely confused?

More likely that I'm confused.  Trust the Sun documentation - those RPG
procedures are just wrappers for standard JNI functions.

I just read the Sun documentation again, and it looks like you are
guaranteed of being able to create N refs in the frame if you reserve
them with PushLocalFrame or EnsureLocalCapacity.  If you don't reserve
enough space for the refs you need, you run the risk of getting halfway
through your routine and being unable to create more refs.  I don't know
if or how it would affect performance if you preallocated space for all
your refs.  I don't know if it would actually use up extra memory, but
I'm guessing it would reserve ref-ids which might cause out-of-memory
errors.

(10000 is probably a ridiculous number of refs to allocate.)

Regarding the default of 16, I think that's for a native method.  A
native method gets an implicit local frame created.  I don't know what
the default is for a JVM started using the invocation API (which is what
happens when the RPG<->Java interaction is started by RPG using JNI).


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.