P
Peter Judge
Guest
Returning a HANDLE is not the same as returning a DATASET-HANDLE (regardless of whether you do it via return values or parameters). The HANDLE is a shallow reference/pointer; the dataset-handle is a deep copy (typically). If you get a handle and the object that holds the TT/PDS that the handle refers is GC'ed, then the handle will point at nothing, hence errors. Is it correct that it is not longer necessary to delete handles explicitly to avoid memory leaks in use cases like this? You should always manually clean up handle-based objects, regardless of OO/procedural code. -- peter From: asthomas [mailto:bounce-asthomas@community.progress.com] Sent: Wednesday, 02 July, 2014 09:24 To: TU.OE.General@community.progress.com Subject: [Technical Users - OE General] OOABL and cleaning up handles OOABL and cleaning up handles Thread created by asthomas A question for the OOABL experts out there... OE 11.3.2 I have some OOABL code that has been updated so that method output parameters returning handles for temp-table, datasets etc. have been changed to use return values on the methods instead. e.g. METHOD PUBLIC VOID rtbGetWorkspace( INPUT pcWorkspaceId AS CHARACTER, OUTPUT TABLE-HANDLE phTT ): RUN rtb/proxy/p/rtbGetWorkspace.p ON AppServerHandle ( INPUT pcWorkspaceId, OUTPUT TABLE-HANDLE phTT). RETURN. FINALLY: DELETE OBJECT phTT NO-ERROR. END FINALLY. END METHOD. Has been changed to: METHOD PUBLIC HANDLE rtbGetWorkspace( INPUT pcWorkspaceId AS CHARACTER): DEFINE VARIABLE hTT AS HANDLE NO-UNDO. RUN rtb/proxy/p/rtbGetWorkspace.p ON AppServerHandle ( INPUT pcWorkspaceId, OUTPUT TABLE-HANDLE hTT). RETURN hTT. END METHOD. Initially, I had the DELETE OBJECT code in the FINALLY of the updated method. But this resulted in the code not working any more, as the returned hTT handle was then ?. Is it correct that it is not longer necessary to delete handles explicitly to avoid memory leaks in use cases like this? TIA Stop receiving emails on this subject. Flag this post as spam/abuse.
Continue reading...
Continue reading...