Skip to content

Type providers get created hundreds of times causing large LOH allocations and UI delays inside VS #5929

@davkean

Description

@davkean

Trace: https://developercommunity.visualstudio.com/content/problem/379653/vs-slow-typing-and-hang-1.html.

GC Rollup By Generation

Gen Count MaxPause MaxPeak MB Max AllocMB/sec TotalPause TotalAlloc MB Alloc MB/MSec GC Survived MB/MSec GC MeanPause Induced
ALL 305 13,100.2 2,515.3 9,389.575 23,078.5 2,845.1 0.1 13.147 75.7 1
0 187 20.6 2,481.5 4,736.269 1,031.3 1,109.3 0.4 0.050 5.5 0
1 108 13,100.2 2,509.7 9,389.575 14,950.0 1,486.1 5.3 0.199 138.4 0
2 10 728.8 2,515.3 14.396 7,097.2 249.7 2.5 20,674.062 709.7 1

In this trace, we're seeing large percentage of time spent collecting generations 1 & 2. If we dig into it, we can see that the majority of Gen2 collections are due to us creating hundreds of the same type providers over and over again, and they themselves allocating around 800KB each time. This results in about ~1.5 GB allocations all ending up on the LOH.

image

I would verify if we actually need to create type providers over and over again, and if not, introduce a cache based on the inputs so that we avoid this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions