Skip to content
This repository was archived by the owner on Dec 18, 2017. It is now read-only.

DTH spent about 300M memory on Microsoft.Dnx.Runtime.Servicing.Breadcrumbs when open MVC solution #2513

Closed
troydai opened this issue Aug 20, 2015 · 3 comments

Comments

@troydai
Copy link
Contributor

troydai commented Aug 20, 2015

Open MVC solution in VS with dnx-clr-win-x86.1.0.0-beta8-15109.

Noticing that about 48% of the managed memory is of type String[] and referred by Microsoft.Dnx.Runtime.Servicing.Breadcrumbs

Snapshot:
image

Name                                                                                    Inc %              Inc      Inc Ct  Exc %            Exc        Exc Ct  Fold    Fold Ct
 mscorlib!String                                                                         52.2      315,924,416  3,508,660.250    52.2    315,924,416    3,508,660.250      0          0
+ mscorlib!String[] (Bytes > 1M,Ptrs,ElemSize=4)                                         48.8      295,422,304  3,272,285.500     0.0              0             0     0          0
|+ mscorlib!List<String>                                                                 48.8      295,422,304  3,272,285.500     0.0              0             0     0          0
| + Microsoft.Dnx.Runtime!Microsoft.Dnx.Runtime.Servicing.Breadcrumbs                    48.8      295,422,304  3,272,285.500     0.0              0             0     0          0
|  + [static var Microsoft.Dnx.Runtime.Servicing.Breadcrumbs.<Instance>k__BackingField]  48.8      295,422,304  3,272,285.500     0.0              0             0     0          0
|   + [static vars]                                                                      48.8      295,422,304  3,272,285.500     0.0              0             0     0          0
|    + [.NET Roots]                                                                      48.8      295,422,304  3,272,285.500     0.0              0             0     0          0
|     + ROOT                                                                             48.8      295,422,304  3,272,285.500     0.0              0             0     0          0
@davidfowl
Copy link
Member

Hah! Nice catch! This is an easy one to fix

@troydai
Copy link
Contributor Author

troydai commented Aug 20, 2015

Observation Note

  1. PackageDependencyProvider keeps adding breadcrumbs throughout the entire life cycle. see here
  2. Since that the PackageDependencyProvider adding breadcrumbs each time GetDescription is called, there are duplicate value in the _breadcrumbsToWrite list. It can be replaced by an HashSet. see here
  3. Set $env:DNX_NO_BREADCRUMBS=1, then the breadcrumbs memory consumption completely disappeared.

I'll begin prototyping some fix.

/cc @davidfowl @victorhurdugaci @rynowak

@rynowak
Copy link
Member

rynowak commented Aug 20, 2015

😻

@davidfowl davidfowl self-assigned this Aug 20, 2015
@davidfowl davidfowl added this to the 1.0.0-beta8 milestone Aug 20, 2015
davidfowl added a commit that referenced this issue Aug 20, 2015
- This ensures bread crumbing only happens at runtime. It removes the side effects when
we use this API to create a library manager.

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

No branches or pull requests

3 participants