× 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.



Joe Pluta wrote:
> ...
> Barbara, if you're still listening: do I have to do anything special to
> make sure that factory gets garbage collected?  Given the fact that I
> only create one per call to the program, and the program is the type
> that is called dozens or hundreds (rather than millions) of times, my
> guess is that even if the factories don't get collected, I can just
> leave them until the job ends.  (Since the factory is creating it's own
> objects, I assume they get GC'd as normal.)
> 

If your Java objects are all completely internal to Java, then you don't
have to do anything special to enable garbage collection.  If your RPG
program has access to any object, you do have to do something special.

The "something" depends on how your RPG program was called.

If it's a native method (called by Java), then any local references
obtained during the call will be released.  If there are no other
references to an object, it will be eligible for garbage collection. 
Usually, this behaviour is fine, but if you save the object references
in static storage in your RPG procedure, and try to access them on a
subsequent call, you have to make them global references before the
first call returns.  (You can see how to do this in the ILE RPG
Programmer's Guide.)

If it's not a native method, then any references to objects have to be
explicitly released to enable garbage collection.

Whether you have to _worry_ about enabling garbage collection depends on
your application and/or what else goes on in the jobs where your
application is running.  But if it's easy to tell when your RPG program
is finished with an object, you might as well free it.  Especially if
your RPG program is later going to be unable to free the object because
it doesn't have the object reference any more.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.