Is there a way to tell if the input parameter was passed usi

Posted by jquerijero on 14-Mar-2018 15:35

I'm dealing with input table-handle that needs to be deleted at the end of the procedure or method to avoid memory-leak. A copy of the temp-table is created upon procedure or method call in this case. The problem is I need to know if the caller specified the BY-REFERENCE keyword, which means I can't just run my usual clean up code. The cleanup might have to be done in the caller code.

Any ideas?  

All Replies

Posted by Mike Fechner on 14-Mar-2018 15:38

Check the NUM-REFERENCES property of the TABLE or ProDatasaet handle..
Von: jquerijero [mailto:bounce-jquerijero@community.progress.com]
Gesendet: Mittwoch, 14. März 2018 21:36
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] Is there a way to tell if the input parameter was passed using BY-REFERENCE?
 
/cfs-file/__key/communityserver-discussions-components-files/19/43513.image001.png
Update from Progress Community
/cfs-file/__key/communityserver-discussions-components-files/19/11164.image002.jpg
 

I'm dealing with input table-handle that needs to be deleted at the end of the procedure or method to avoid memory-leak. A copy of the temp-table is created upon procedure or method call in this case. The problem is I need to know if the caller specified the BY-REFERENCE keyword, which means I can't just run my usual clean up code. The cleanup might have to be done in the caller code.

Any ideas?  

View online

 

You received this notification because you subscribed to the forum.  To stop receiving updates from only this thread, go here.

Flag this post as spam/abuse.

Das Bild wurde vom Absender entfernt.
 

Posted by Peter Judge on 14-Mar-2018 15:42

Does that work for BY-REFERENCE too? The doc seems to indicate it’s for REFERENCE-ONLY - documentation.progress.com/.../index.html  

Posted by Tim Kuehn on 14-Mar-2018 15:45

If this is in a persistent procedure or class you can grab the table's handle when the instance is instantiated and store that. In the API call check to see if the stored handle matches the table's current handle - if they're different, you have a by-reference call. If they're the same, it's local and the call was by-value.

Posted by jquerijero on 14-Mar-2018 16:04

Peter,

Is there a reason why implicitly (temp-table and prodataset handle) created copies by the framework can't be cleaned up automatically by the framework?

Posted by Mike Fechner on 14-Mar-2018 16:59

Peter, my test shows that BY-REFERENCE works nicely without REFERENCE-ONLY definitions.

It's 0 when called without BY-REFERENCE (and the caller would have to delete)

It's 1 when called with BY-REFERENCE (and the caller should usually not have to delete).

Posted by jquerijero on 14-Mar-2018 17:02

Thank you for confirming this.

[quote user="Mike Fechner"]

Peter, my test shows that BY-REFERENCE works nicely without REFERENCE-ONLY definitions.

It's 0 when called without BY-REFERENCE (and the caller would have to delete)

It's 1 when called with BY-REFERENCE (and the caller should usually not have to delete).

[/quote]

Posted by Mike Fechner on 14-Mar-2018 17:04

Should have been "callee", not caller in my response above.

Posted by jquerijero on 15-Mar-2018 14:19

It didn't work for me. It's always returning 0.

I'm on 11.6.

Caller: procedure (.p)

Callee: class (.cls)

[quote user="Mike Fechner"]

Peter, my test shows that BY-REFERENCE works nicely without REFERENCE-ONLY definitions.

It's 0 when called without BY-REFERENCE (and the caller would have to delete)

It's 1 when called with BY-REFERENCE (and the caller should usually not have to delete).

[/quote]

This thread is closed