Is there a way to tell if the input parameter was passed using BY-REFERENCE? - Forum - OpenEdge Development - Progress Community

Is there a way to tell if the input parameter was passed using BY-REFERENCE?

 Forum

Is there a way to tell if the input parameter was passed using BY-REFERENCE?

This question is not answered

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

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • Does that work for BY-REFERENCE too? The doc seems to indicate it’s for REFERENCE-ONLY - documentation.progress.com/.../index.html  
  • 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.

  • 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?

  • 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).

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • Thank you for confirming this.

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

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

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

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

    I'm on 11.6.

    Caller: procedure (.p)

    Callee: class (.cls)

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