I know that GC is an automatic function for progress classes. Does anyone have any indication of how robust / accurate / timely this is ?
Given that the following code
METHOD PUBLIC VOID Remove(p_WorkQueueGUID AS CHAR): DEF VAR WorkQueue1 AS CLASS ValueObject.WorkQueue NO-UNDO. WorkQueue1 = GetWorkQueue(p_WorkQueueGUID). Remove(WorkQueue1). DELETE OBJECT WorkQueue1. RETURN. END METHOD.
/* where GetWorkQueue returns a ValueObject.WorkQueue object */
could be written as
METHOD PUBLIC VOID Remove(p_WorkQueueGUID AS CHAR): Remove(GetWorkQueue(p_WorkQueueGUID)). RETURN. END METHOD.
I am tempted to use the second form. However, I'm not sure about the automatic GC.
Anyone got any thoughts or comments ?
METHOD PUBLIC VOID Remove(p_WorkQueueGUID AS CHAR):
Remove(GetWorkQueue(p_WorkQueueGUID)).
RETURN.
END METHOD.
I do this all the time. The only downside of it is that if Remove() is outside your control (ie a .NET method), you can't inspect the ValueObject.WorkQueue object in transit.
If the GC doesn't work in this case, then it's a yuge (or even huge) bug.
There are some who will tell you to always delete your objects manually, but IMO that's what the GC is there for. Note that you can follow the wanton destruction of GC'd objects with the LOG-MANAGER (they're called out specifically).
-- peter