Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025

 


Article

Objects not deleted from memory immediately

« Go Back

Information

 
Article Number000013806
EnvironmentProduct: OpenEdge
Version: 10.2x, 11.x
OS: Windows
Other: .NET
Question/Problem Description
Object not deleted from memory immediately.
Objects are not deleted when expected when inheriting from .NET.
Destructor is not run when expected.
Memory leak with objects inheriting from System.Object.
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
This is a expected behavior.

- If a class inherits from Progress.Lang.Object, only the OpenEdge garbage collection is used. OpenEdge garbage collection tries to clean memory almost immediately when a object is not needed, running the code in a destructor.
- If a class inherits from System.Object, .NET garbage collection is used. .NET garbage collection works differently than OpenEdge garbage collection, cleaning memory at different intervals. In this case, the objects stay in memory for much longer. However, they will eventually be deleted.
- For hybrids (ABL classes that inherit from .NET classes, so they have System.Object at the top of the hierarchy), the ABL side is not garbage-collected until the AVM detects the .NET portion is garbage-collected. This is checked when a further call to .NET is made. As a result, the ABL portion can stay in memory slightly longer than the .NET portion.
Resolution
1. If needed, force .NET garbage collection using the following code:
System.GC:Collect().
System.GC:WaitForPendingFinalizers().
System.GC:Collect().

Note that this will temporarily block the session. Therefore, to minimize impact it's recommended this is done in the clean-up steps of a program and only if the program causes excessive memory usage.

2. Alternatively, explicitly DELETE OBJECT the instances that are no longer needed. This will free up the resources on the ABL side, and will help ensure that the .NET portion becomes garbage-collectable. 
Workaround
Notes
Attachment 
Last Modified Date9/7/2018 9:55 AM