问题
I run a concurrency profile of a software in Visual Studio 2010 and found some contentions on lines of code that are not within locks. Say, a new operation to create an array, or a thread-local DynamicMethod.Invoke call. Some contentions are on simply assignments. I could not figure out why these lines cause intentions because there should be no way they are under any lockings in my code.
Anyone experiences similar problems? I think the contentions displayed in VS2010 concurrency profiler should all be caused by waiting on a lock or entering a piece of mutex section. Thanks.
回答1:
Newing an array and jitting your dynamic method would both allocate memory, so is it possible that it's just contention in the allocator? Of course, that doesn't explain the assignment lines...
来源:https://stackoverflow.com/questions/4495987/why-there-are-contentions-in-places-with-no-lockings