提交 d34becfa 编写于 作者: J Jared Parsons

Limit dump count

上级 55e30230
...@@ -450,6 +450,7 @@ internal sealed class RuntimeAssemblyManager : MarshalByRefObject, IDisposable ...@@ -450,6 +450,7 @@ internal sealed class RuntimeAssemblyManager : MarshalByRefObject, IDisposable
// The key is the manifest module MVID, which is unique for each distinct assembly. // The key is the manifest module MVID, which is unique for each distinct assembly.
private static readonly ConcurrentDictionary<Guid, Assembly> s_domainAssemblyCache; private static readonly ConcurrentDictionary<Guid, Assembly> s_domainAssemblyCache;
private static readonly ConcurrentDictionary<Guid, Assembly> s_domainReflectionOnlyAssemblyCache; private static readonly ConcurrentDictionary<Guid, Assembly> s_domainReflectionOnlyAssemblyCache;
private static int s_dumpCount;
// Modules managed by this manager. All such modules must have unique simple name. // Modules managed by this manager. All such modules must have unique simple name.
private readonly Dictionary<string, ModuleData> _modules; private readonly Dictionary<string, ModuleData> _modules;
...@@ -723,8 +724,17 @@ public static string DumpAssemblyData(IEnumerable<ModuleData> modules, out strin ...@@ -723,8 +724,17 @@ public static string DumpAssemblyData(IEnumerable<ModuleData> modules, out strin
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
foreach (var module in modules) foreach (var module in modules)
{ {
// Limit the number of dumps to 10. After 10 we're likely in a bad state and are
// dumping lots of unnecessary data.
if (s_dumpCount > 10)
{
break;
}
if (module.InMemoryModule) if (module.InMemoryModule)
{ {
Interlocked.Increment(ref s_dumpCount);
if (dumpDirectory == null) if (dumpDirectory == null)
{ {
var assemblyLocation = typeof(HostedRuntimeEnvironment).Assembly.Location; var assemblyLocation = typeof(HostedRuntimeEnvironment).Assembly.Location;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册