Kbase P18103: Dynamic Objects Explained.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/19/2005 |
|
Status: Unverified
GOAL:
Dynamic Objects Explained.
FACT(s) (Environment):
Progress 9.1x
OpenEdge 10.x
FIX:
Dynamic Objects.
Heap allocation or dynamic allocation means run-time allocation and deallocation of storage in arbitrary order.
Dynamic allocation is usually for objects whose size, quantity, or lifetime could not be determined at compile-time. They are created and bound at run time. The compiler does not know that they exist, They are allocated totally at run time. Memory is only allocated when the CREATE.... SET or RUN...... ASSYNC statement executes. Memory is not garbage collected automatically. To avoid problems of leakage with dynamic objects use always DELETE OBJECT.
Example:
DEFINE VARIABLE hQryAS HANDLE NO-UNDO.
CREATE QUERY hQry.
HQUERY:SET-BUFFERS(HBUFFER).
HQRY:QUERY-PREPARE(...).
HQRY:QUERY-OPEN().
HQRY:GET-FIRST().
REPEAT WHILE NOT hQry:QUERY-OFF-END:
hQry:GET-NEXT().
END.
hQry:QUERY-CLOSE().
DELETE OBJECT hQry.