私はOutOfMemoryException
を投げる.NETプログラムを持っています。ProcDumpを使用してOutOfMemory例外のダンプをキャプチャできません
public static int Main(string[] args)
{
try
{
...
}
catch (Exception exc)
{
Console.Error.WriteLine(exc);
return 1;
}
}
今、私はこの例外がスローされた瞬間を作成するメモリダンプを希望:Main
関数は次のような構造を有しているため、例外が、処理されます。そのために私は次のコマンドを使用します。
procdump.exe -e 1 -f OutOfMemoryException -g -ma -w Log4Net2DB.exe
をしかし、それは動作しません:
PS D:\tmp> procdump.exe -e 1 -f OutOfMemoryException -g -ma -w Log4Net2DB.exe
ProcDump v7.0 - Writes process dump files
Copyright (C) 2009-2014 Mark Russinovich
Sysinternals - www.sysinternals.com
With contributions from Andrew Richards
Waiting for process named Log4Net2DB.exe...
Process: Log4Net2DB.exe (47712)
CPU threshold: n/a
Performance counter: n/a
Commit threshold: n/a
Threshold seconds: 10
Hung window check: Disabled
Log debug strings: Disabled
Exception monitor: First Chance+Unhandled
Exception filter: *OutOfMemoryException*
Terminate monitor: Disabled
Cloning type: Disabled
Concurrent limit: n/a
Avoid outage: n/a
Number of dumps: 1
Dump folder: D:\tmp\
Dump filename/mask: PROCESSNAME_YYMMDD_HHMMSS
Press Ctrl-C to end monitoring without terminating the process.
[18:09:30] Exception: E0434F4E.CON
[18:09:41] Exception: E0434F4E.CON
[18:09:41] Exception: E0434F4E.CON
[18:09:48] Exception: E0434F4E.CON
[18:10:27] Exception: E0434F4E.CON
[18:10:36] Exception: E0434F4E.CON
[18:10:43] Exception: E0434F4E.CON
[18:10:45] Exception: E0434F4E.CON
[18:10:46] Exception: E0434F4E.CON
[18:10:51] Exception: E0434F4E.CON
[18:10:55] Exception: E0434F4E.CON
[18:10:59] Exception: E0434F4E.CON
[18:11:10] Exception: E0434F4E.CON
[18:11:28] Exception: E0434F4E.CON
[18:11:38] Exception: E0434F4E.CON
[18:11:55] Exception: E0434F4E.CON
[18:13:58] Exception: E0434F4E.CON
[18:15:33] Exception: [email protected]@
[18:15:33] Exception: E0434352.CLR
[18:15:33] Exception: E0434352.CLR
[18:15:33] Exception: E0434352.CLR
[18:15:33] Exception: E0434352.CLR
[18:15:33] Exception: E0434352.CLR
[18:15:33] Exception: E0434352.CLR
[18:15:33] Exception: E0434352.CLR
[18:15:33] Exception: E0434352.CLR
[18:15:33] Exception: E0434352.CLR
[18:15:33] Exception: E0434352.CLR
[18:15:33] Exception: E0434352.CLR
[18:15:33] Exception: C0020001
[18:15:35] The process has exited.
[18:15:35] Dump count not reached.
PS D:\tmp>
お知らせの最後のメッセージ - 「に達していないカウントダンプ」。しかし、プログラムが(Main
関数の最後にcatch
声明で取り扱わ)OutOfMemoryException
で終了しない:
procdump.exe -e 1 -f C0020001 -g -ma -w Log4Net2DB.exe
:レコードの
PS D:\tmp> logs2db.ps1 -- -dir D:\tmp\us850 -r -db us850
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Security.Cryptography.SHA1Managed..ctor()
at Log4Net2DB.Program.ComputeHash(ILogEntry logEntry, BinaryWriter bw) in C:\Log4Net2DB\Log4Net2DB\Program.cs:line 246
at Log4Net2DB.Program.<>c__DisplayClass10_0.<GetBatchSource>b__2(ILogEntry entry) in C:\Log4Net2DB\Log4Net2DB\Program.cs:line 232
at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
--- End of stack trace from previous location where exception was thrown ---
at System.Reactive.PlatformServices.DefaultExceptionServices.Rethrow(Exception exception)
at System.Reactive.ExceptionHelpers.ThrowIfNotNull(Exception exception)
at System.Reactive.Subjects.AsyncSubject`1.GetResult()
at Log4Net2DB.Program.Main(String[] args) in C:\Log4Net2DB\Log4Net2DB\Program.cs:line 200
PS D:\tmp>
、私はまた、このようなprocdump
を実行しようとしました無駄に。
注意、procdump.exe -e 1 -g -ma -w Log4Net2DB.exe
を実行すると上昇し、GCがトリガされ、実行時によって内部的に処理された非常に最初の例外のためのダンプを生成しないことを、より多くの詳細はこちらです - RedirectedThreadFrame in Callstackので、私はprocdump
をすることができます知っています私のプログラムのためのダンプを作り出す。
しかし、OOMのダンプを生成することはできません。私は間違って何をしていますか?
P.S.
私のマシンは64ビットですが、いくつかの特殊な理由から、プログラムは32ビットとして実行されますが、インターロックDLLを参照しません。したがって、約3.7GBのRAMを消費するとOOMが発生します。