I found that quickfix_net_messages creates temporary message internally
objects and does not Dispose of them.
This is a problem because during the creation of a managed Message object in
quickfix_net Message.h, GC::AddMemoryPressure is called. Without an
explicit call to Dispose, the corresponding RemoveMemoryPressure is not
called.
I've observed that this "MemoryPressure leak" causes a flurry of
long-running induced garbage collections especially when using the .NET 4.0
CLR. I found this using the PerfMonitor.exe tool that is distrbuted by
Microsoft.
One stack trace that documents the internal creation of temporary Message
objects is:
quickfixquickfix_net_messages!QuickFix42.MessageFactory.create(
string,string )
quickfix_net_messages!QuickFix.DefaultMessageFactory.create( string,string )
quickfix_net!<Module>.Application.create( Application*,Message* )
quickfix_net!<Module>.Application.toApp( Application*,Message*,SessionID* )
[Native to managed transition]
[Managed to native transition]
quickfix_net!<Module>.FIX.Session.sendToTarget( Message*,SessionID* )
quickfix_net!QuickFix.Session.sendToTarget( Message,SessionID )
This stacktrace is reported by the Scitech .NET Memory Profiler 4.0 beta.
I want to underscore the fact that this object is being created by quickfix
during the processing of sendToTarget and I have no way of getting a handle
to this object to Dispose it on my own.
I tried commenting out calls to GC:AddMemoryPressure and
GC::RemoveMemoryPressure and the induced GC's disappear completely.
Performance improves drastically.
Commenting out GC:AddMemoryPressure and GC::RemoveMemoryPressure is probably
not the right fix. Can you fix this in a proper way?
Here is a related post:
http://old.nabble.com/Memory-Leak---Please-help.-ts16177017.html#a16597001
--
View this message in context: http://old.nabble.com/Managed-Message-objects-created-by-quickfix_net-are-not-explicitly-Dispose%28d%29-tp31744531p31744531.html
Sent from the QuickFIX - Dev mailing list archive at Nabble.com.
|