Add infinite codegen stress feature to crossgen2 and fix memory usage issues...
Add infinite codegen stress feature to crossgen2 and fix memory usage issues found while doing so (#74956) - Add Inifinite codegen stress mode which runs the compilation portion of crossgen2 in an infinite loop - Fix a couple of memory leaks around PInvokeTargetNativeMethod and UnboxingMethodDesc - These were being stored into long-lived data structures, and I was able to make at least UnboxingMethodDesc have a feature which prevents them from being stored for a long period of time - Address a number of scenarios where we allocate tremendous amounts of useless garbage - Our pattern for using ConcurrentDictionary was allocating a delegate on every lookup - Tweak ModuleTokenResolver to not need to allocate new copies of the `TokenResolverProvider` and the various `ImmutableArray` objects in the signature decoders as we don't actually need the return value from those apis. - Tweak parallelization strategy to use raw threads instead of `Parallel.ForEach` - This allows us to easily control thread lifetime, as well as providing a means to eliminate old and no-longer used `CorInfoImpl` instances. - This should address to some extent high levels of memory needed for compilation seen by some customers # Inifite codegen stress mode Enable by passing --codegenopt:InfiniteCompileStress=1 on the command line A simple way to use this would be to run stress it on system.private.corelib.dll. Assuming that a release clr+libs has been built and your enlistment is in `c:\gitdir\runtime`, run something like the following ``` pushd c:\gitdir\runtime src\tests\build generatelayoutonly set CORE_ROOT=C:\gitdir\runtime\artifacts\tests\coreclr\windows.x64.Release\tests\core_root SET DOTNET_gcServer=1 SET DOTNET_GCHeapCount=6 %CORE_ROOT%\corerun C:\gitdir\runtime\artifacts\bin\coreclr\windows.x64.Release\crossgen2\crossgen2.dll -o:C:\temp\System.Private.CoreLib.dll -r:C:\gitdir\runtime\artifacts\bin\coreclr\windows.x64.Release\IL\*.dll --targetarch:x64 -m:C:\gitdir\runtime\artifacts\bin\coreclr\windows.x64.Release\StandardOptimizationData.mibc --embed-pgo-data -O C:\gitdir\runtime\artifacts\bin\coreclr\windows.x64.Release\IL\System.Private.CoreLib.dll --pdb --pdb-path:C:\temp --codegenopt:InfiniteCompileStress=1 ``` That will run for an infinite period of time, and stress the GC and various other aspects of the runtime.
Showing
想要评论请 注册 或 登录