Forum Post: RE: Memory leak in OpenEdge.Net.HTTP classes?

Status
Not open for further replies.
P

Peter Judge

Guest
[apologies for the long post. the TL;DR is there were a couple of leaks, which are fixed in 11.6 and also be careful of reading too much into the log-manager's outout] After some investigation I found 2 styles of leak - the circular one I mentioned earlier, where a .P is run persistently from an object and which holds a reference to the object, thus rendering garbage collection impotent.\ - i like to use a Initialize/Destroy pattern instead of trusting a constructor to do everything; this requires someone to call the Initialize method on object construction (done) and the Destroy method when the object is being destroyed. This wasn't always done. The log-manager's output from DynObjects.* - especialy with a high enough log level - needs to be carefully read - Entries that refer to LONGCHAR only, like the line below are intended for internal-to-ABL-core developers for their edification and delight (and not for ours). They can be safely ignored. PutBytes OpenEdge.Core.ByteBucket @ 193 x166750 LONGCHAR 19 - Sometimes, the AVM creates objects internally from non-object arguments you pass it. The line below NewRequest OpenEdge.Net.HTTP.DefaultRequestBuilder @ 54 0 Progress.Lang.Object Progress.Lang.ParameterList is the result of the following ABL oRequest = dynamic-new string(oRequestType:TypeName)( GetOptionStringValue('method':u), cast(GetOptionObjectValue('uri':u), URI)). The AVM changes the 2 arguments into a Progress.Lang.ParameterList object over which you have no control. You have to take it on faith that that object will be "GC'ed" - Objects that are 'held' by static members will only show up as created and not deleted. For instance, the following code /** Registry for mapping build types to their implementations */ define static public property Registry as BuilderRegistry no-undo get(): define variable oRegistry as BuilderRegistry no-undo. if not valid-object(RequestBuilder:Registry) then do: assign oRegistry = new BuilderRegistry(). RequestBuilder:InitializeRegistry(oRegistry). assign RequestBuilder:Registry = oRegistry. end. return RequestBuilder:Registry. end get. private set. shows up in the logs as propGet_Registry OpenEdge.Net.HTTP.RequestBuilder @ 74 1049 Progress.Lang.Object OpenEdge.Net.HTTP.BuilderRegistry However, there are no corresponding Deleted-by-GC entries. This is because of the fact that the references are held by static members which are destroyed by the AVM when the session shuts down; this destruction happens in an purely internal way, and so there are no logs of the event. hth

Continue reading...
 
Status
Not open for further replies.
Top