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



Barbara,

That is going to get tricky when you embed Java in a
subprocedure. The code I am working with is supposed
to hide these types of problems. I also can't guarantee
what will be called when and certainly don't know when
something is no longer needed. Does the JVM end on
an error?

In a similar situation (fortunately all RPGIV) I registered
a cleanup routine. If the object wasn't registered you could
not use the procedures in this case that required the help
of a cleanup.

In this case the Cleanup object might contain a
vector so I would wrap newString('blablabla') with
something like regClean(newString('blablalba')) with
regClean taking an object and putting that reference
in some sort of collection.

A registered exit would perform the cleanup by
calling another method in Cleanup.

David Morris

>>> bmorris@ca.ibm.com 02/08/02 03:23PM >>>

>Date: Fri, 08 Feb 2002 15:03:49 -0700
>From: "David Morris" <David.Morris@plumcreek.com>
>
>Thanks for the tip. You are right that it not intuitive to have to
>clean up a reference to a String. I changed that code from
>something that looked like the following because nested
>calls were getting hard to follow.
>
>     invElement = newElement(newString('invoice'));
>
>In this case I am guessing that it holds the reference from
>the invElement and will allow garbage collect for the string
>when the element is released. If this is the case I will try to
>use this notation.

Sorry David, that's even worse.  That way, you don't even have a
chance to get the reference to free it later.  RPG doesn't do
any garbage collection at all (except for objects it implicitly
creates, like Java arrays for array parameters).  Java can't,
because it doesn't know the difference between the 2-statement
version and the nested version.  From its point of view there
are just 2 calls.

Barbara Morris



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.