Why there are contentions in places with no lockings?

僤鯓⒐⒋嵵緔 提交于 2019-12-11 07:09:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!