微软UCMA:字符串不被垃圾收集
本文关键字:UCMA 字符串 微软 | 更新日期: 2023-09-27 18:13:04
我在我的UCMA应用程序上运行内存分析器,该应用程序作为客户端将记录器参与者添加到会话中,我注意到很多字符串实例占用内存(即使参与者被删除并且经过一段时间的不活动后,我注意到这些字符串不会被垃圾收集):
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.DiagnosticsInformation..ctor( int,DiagnosticVisibility )
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.DiagnosticsInformation.CreateOutgoingDiagnosticsInformation( uint )
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Collaboration.Call.SignalingSession_StateChanged( object,SignalingStateChangedEventArgs )
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.EventWorkitem<TEventArgs>.Process()
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.WorkitemQueue.ProcessItems()
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.SerializationQueue<T>.ResumeProcessing()
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.SerializationQueue<T>.ResumeProcessingCallback( object )
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.QueueWorkItemState.ExecuteWrappedMethod( WaitCallback,object )
mscorlib!System.Threading.ExecutionContext.Run( ExecutionContext,ContextCallback,object )
mscorlib!System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal( _ThreadPoolWaitCallback )
mscorlib!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback( object )
我看到大约2000个这样的实例,它们没有被清理。有没有人以前见过这个并且知道原因是什么或者这是否是框架本身的UCMA问题?
编辑:我还看到框架上有很多反序列化(XML反序列化对象没有被清理?)
System.Xml!System.Xml.Serialization.XmlSerializer.Deserialize( XmlReader,string,XmlDeserializationEvents )
System.Xml!System.Xml.Serialization.XmlSerializer.Deserialize( XmlReader,string )
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.XmlHelper.DeserializeObjectFragment( byte[],XmlSerializer )
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Collaboration.Conferencing.ConferenceJoinCommandResponse.TryProcessResponseCore( SipMessageData,ref RealTimeException )
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Collaboration.Conferencing.EstablishFocusSessionsAsyncResult.ParticipateCallback( IAsyncResult )
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.CompletionCallbackWorkItem.Microsoft.Rtc.Signaling.IWorkitem.Process()
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.WorkitemQueue.ProcessItems()
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.SerializationQueue<T>.ResumeProcessing()
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.SerializationQueue<T>.ResumeProcessingCallback( object )
Microsoft.Rtc.Collaboration!Microsoft.Rtc.Signaling.QueueWorkItemState.ExecuteWrappedMethod( WaitCallback,object )
mscorlib!System.Threading.ExecutionContext.Run( ExecutionContext,ContextCallback,object )
mscorlib!System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal( _ThreadPoolWaitCallback )
mscorlib!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback( object )
some time of inactivity
不触发垃圾回收。在内存中看到大量string或任何其他类的实例并没有错。而内部字符串(编译时常量)永远不会被收集。
在得到out - memory异常之前没有内存泄漏