2010-06-20 8 views
2

WCF 서비스가 있으며 메모리 할당을 프로파일 링합니다.
ExecutionContext.CreateCopy
ExecutionContext.Run
이 모든 할당도하지 :
나는 36 % 각 요청에 할당 된 메모리의 차례로 다음 호출 TimerCallBack.PerformTimerCallback을 통해 할당되는 것을 볼 수 내 코드를 살펴보고 Hahtable.bucket 및 ExecutionContextRunData와 같은 일반적인 객체 만 할당합니다.TimerCallback.PerformTimerCallback 메모리 할당

나는 서비스를 위해 특별한 이유 때문에 타이머를 사용하고 있으며, 부울을 업데이트하는 간단한 콜백으로 모든 요청마다 하나를 만들고 그 직후에 처리합니다. 그것은 관련 될 수 있습니까? 모든 할당이 온다에서

<root> : 41 MB (100.00%) 
System.Threading._TimerCallback::PerformTimerCallback static void (Object): 41 MB (100.00%) 
    System.Threading.ExecutionContext::CreateCopy System.Threading.ExecutionContext(): 30 MB (73.96%) 
    System.Threading.ExecutionContext::Run static void (System.Threading.ExecutionContext System.Threading.ContextCallback Object): 11 MB (26.04%) 
    System.Threading.ExecutionContext::RunInternal static void (System.Threading.ExecutionContext System.Threading.ContextCallback Object): 7.8 MB (19.18%) 
    System.Data.ProviderBase.DbConnectionFactory::PruneConnectionPoolGroups void (Object): 2.6 MB (6.42%) 
    System.Data.ProviderBase.DbConnectionPool::CleanupCallback void (Object): 183 kB (0.44%) 
    System.Data.ProviderBase.DbConnectionPoolGroup::ClearInternal bool (bool): 1.2 MB (3.06%) 
    System.Collections.Generic.Dictionary<T,U>::.ctor void (int32): 840 kB (2.02%) 
    System.Threading.ThreadPool::QueueUserWorkItem static bool (System.Threading.WaitCallback): 183 kB (0.44%) 
    System.Collections.Generic.Dictionary<T,U>::.ctor void (int32 <UNKNOWN>): 840 kB (2.02%) 
    System.Collections.Specialized.HybridDictionary::Add void (Object Object): 305 kB (0.73%) 
    System.Collections.Specialized.HybridDictionary::GetEnumerator void(): 255 kB (0.61%) 
    System.Collections.Specialized.ListDictionary::Add void (Object Object): 255 kB (0.61%) 
    System.Collections.Specialized.ListDictionary.NodeEnumerator::get_Current Object(): 204 kB (0.49%) 
    System.Threading.ThreadPool::QueueUserWorkItemHelper static bool (System.Threading.WaitCallback Object System.Threading.StackCrawlMark& bool): 183 kB (0.44%) 
     System.Collections.Generic.Dictionary<T,U>::Initialize void (int32): 840 kB (2.02%) 
     System.Threading._ThreadPoolWaitCallback::.ctor void (System.Threading.WaitCallback Object bool System.Threading.StackCrawlMark&): 135 kB (0.32%) 
     System.Threading.ExecutionContext::Capture static System.Threading.ExecutionContext (System.Threading.StackCrawlMark&): 135 kB (0.32%) 
     System.Runtime.Remoting.Messaging.LogicalCallContext::Clone Object(): 26 MB (63.75%) 
     System.Collections.Hashtable::.ctor void (int32 float32): 15 MB (36.34%) 
     System.Collections.Hashtable::GetEnumerator System.Collections.IDictionaryEnumerator(): 2.9 MB (7.07%) 
      System.Collections.Hashtable.bucket [] : 15 MB (36.34%) 
      System.Threading.ExecutionContext.ExecutionContextRunData : 7.8 MB (19.18%) 
      System.Collections.Hashtable : 4.5 MB (11.10%) 
      System.Threading.ExecutionContext : 4.3 MB (10.53%) 
      System.Runtime.Remoting.Messaging.LogicalCallContext : 3.8 MB (9.24%) 
      System.Collections.Hashtable.HashtableEnumerator : 2.9 MB (7.07%) 
      System.Collections.Generic.Dictionary<T,U>.Entry [] : 611 kB (1.47%) 
      System.Collections.Generic.Dictionary<T,U> : 560 kB (1.34%) 
      System.Collections.Specialized.ListDictionary : 305 kB (0.73%) 
      System.Collections.Specialized.ListDictionary.NodeEnumerator : 255 kB (0.61%) 
      System.Collections.Specialized.ListDictionary.DictionaryNode : 255 kB (0.61%) 
      System.Collections.Specialized.HybridDictionary : 255 kB (0.61%) 
      System.Int32 [] : 229 kB (0.55%) 
      System.Collections.DictionaryEntry : 204 kB (0.49%) 
      System.Threading._ThreadPoolWaitCallback : 48 kB (0.12%) 
      <bottom> : 41 MB (100.00%) 

:

여기에 관련 할당 그래프입니까? 이게 정상인가?
그 중 일부를 낮추는 방법이 있습니까?

+0

타이머를 사용합니까? 그리고 InstancePerCall은 어떤 인스턴스 모델입니까? –

+0

나는 Timer와 InstancePerCall 모델을 사용한다. –

+0

또한 타이머의 콜백은 시간 초과 감지를위한 플래그 만 업데이트한다고 덧붙여 야합니다. –

답변

0

완전성을 위해 MaxBufferSize 및 MaxBufferPoolSize 값을 이전 값의 1,000 배로 변경 한 문제가있었습니다.