Kbase P100549: How to clean up all outstanding dynamic database objects from memory?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  9/3/2008 |
|
Status: Verified
GOAL:
How to clean up all outstanding dynamic database objects from memory?
FACT(s) (Environment):
OpenEdge 10.x
All Supported Operating Systems
OpenEdge Category: Language (4GL/ABL)
FIX:
The sample code shown below can be used to find and remove all of the following object types from memory:
DataSet
DataSource
Buffer
Query
Persistent Procedure
This code is particularly useful when running complex code on the AppServer where it would be easier to understand the login of the code if deletion of dynamic objects were deferred until the end of the program...
DEFINE VARIABLE hTemp AS HANDLE NO-UNDO.
DEFINE VARIABLE hObject AS HANDLE NO-UNDO.
ASSIGN hObject = SESSION:FIRST-DATASET.
DO WHILE hObject <> ?:
ASSIGN hTemp = hObject
hObject = hObject:NEXT-SIBLING.
DELETE OBJECT hTemp NO-ERROR.
END.
ASSIGN hObject = SESSION:FIRST-DATA-SOURCE.
DO WHILE hObject <> ?:
ASSIGN hTemp = hObject
hObject = hObject:NEXT-SIBLING.
DELETE OBJECT hTemp NO-ERROR.
END.
ASSIGN hObject = SESSION:FIRST-BUFFER.
DO WHILE hObject <> ?:
ASSIGN hTemp = hObject
hObject = hObject:NEXT-SIBLING.
DELETE OBJECT hTemp NO-ERROR.
END.
ASSIGN hObject = SESSION:FIRST-PROCEDURE.
DO WHILE hObject <> ?:
ASSIGN hTemp = hObject
hObject = hObject:NEXT-SIBLING.
DELETE OBJECT hTemp NO-ERROR.
END.
ASSIGN hObject = SESSION:FIRST-QUERY.
DO WHILE hObject <> ?:
ASSIGN hTemp = hObject
hObject = hObject:NEXT-SIBLING.
DELETE OBJECT hTemp NO-ERROR.
END.