Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive memory allocation comparing paths in evaluation. #2348

Closed
AndyGerlicher opened this issue Jul 21, 2017 · 3 comments
Closed

Excessive memory allocation comparing paths in evaluation. #2348

AndyGerlicher opened this issue Jul 21, 2017 · 3 comments

Comments

@AndyGerlicher
Copy link
Contributor

Based on developer community feedback:
https://developercommunity.visualstudio.com/content/problem/80371/visual-studio-becomes-unresponsive-for-a-few-minut.html

This customer reported issue is showing some extreme build behavior https://devdiv.visualstudio.com/DevDiv/_workitems/edit/464792

Here we can see his profile shows 9GB of allocations for normalizing paths during the build (profile is available in the developer community comments)

Name Inc % Inc
microsoft.build.ni!FileUtilities.NormalizePathForComparisonNoThrow 83.2 9,816,500,224.000
microsoft.build.ni!FileUtilities.ComparePathsNoThrow 83.2 9,816,500,224.000
microsoft.build.ni!Microsoft.Build.Internal.EngineFileUtilities+<>c__DisplayClass6_0.b__0(System.String) 83.2 9,816,500,224.000
microsoft.build.ni!ItemFragment.MatchCount 83.2 9,816,500,224.000
microsoft.build!Microsoft.Build.Evaluation.ItemExpressionFragment`2+<>c__DisplayClass12_0[System.__Canon,System.__Canon].b__0(class Microsoft.Build.Evaluation.ValueFragment) 83.0 9,786,655,744.000
system.core.ni!System.Linq.Enumerable.Count[System.__Canon](System.Collections.Generic.IEnumerable1, System.Func2) 83.0 9,786,655,744.000
microsoft.build!Microsoft.Build.Evaluation.ItemExpressionFragment`2[System.__Canon,System.__Canon].MatchCount(class System.String) 83.0 9,786,655,744.000
microsoft.build.ni!Microsoft.Build.Evaluation.ItemSpec`2+<>c__DisplayClass17_0[System.__Canon,System.__Canon].b__0(Microsoft.Build.Evaluation.ItemFragment) 83.0 9,786,655,744.000
microsoft.build.ni!Microsoft.Build.Evaluation.ItemSpec`2+<>c__DisplayClass17_0[System.__Canon,System.__Canon].b__0(Microsoft.Build.Evaluation.ItemFragment) 0.3 29,843,840
system.core.ni!System.Linq.Enumerable.Any[System.__Canon](System.Collections.Generic.IEnumerable1, System.Func2) 0.3 29,843,840
microsoft.build.ni!Microsoft.Build.Evaluation.ItemSpec`2[System.__Canon,System.__Canon].MatchesItem(System.__Canon) 0.3 29,843,840

The user simply added a nuget reference to a project and VS got stuck for over 5 minutes.
The profile is entirely in the in-proc build system.

@AndyGerlicher AndyGerlicher added this to the MSBuild 15 "foundation update" 2 milestone Jul 21, 2017
@davkean
Copy link
Member

davkean commented Aug 9, 2017

CPU:
43% of his project is a design-time build from the legacy project system on the UI thread, of which almost all of it spent in evaluation comparing paths. He says he’s moved over to new project system, but looks like there’s still projects using the old one. I don’t see a lot of disk searching, so I’m not sure why we’re spending lots of time here.
25% is https://github.com/dotnet/corefx/issues/22771 (I filed #2411 for MSBuild change)
10% is #2392
10% is GC time (which resulted in about 7 seconds of UI delays)
4% is https://github.com/dotnet/corefx/issues/21105 (probably because events are turned on)
2% is throwing exceptions (!) – can’t see any stacks to get anything useful here – maybe #2217?

Memory:
80.4% (8.5 GB) #2348 (this is minus below)
16% (2GB) #2284 (Fixed)
6% (700 MB) #2378 (Fixed)

@davkean
Copy link
Member

davkean commented Aug 9, 2017

Besides the ones I've already called out, the majority of this looks like: #2326.

@davkean
Copy link
Member

davkean commented Aug 9, 2017

@AndyGerlicher I think this can be resolved - this looks to be caused mainly by the underlying cause of #2326 and I've filed/pointed to bugs for the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants