diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-04 23:03:07 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-04 23:03:07 +0000 |
commit | c3af62bc97e3aa9b1a135fcea9b6579e0d209715 (patch) | |
tree | b18586a76e508d1503f8acb8436e93bab6ba6d56 /chrome/app/chrome_dll_main.cc | |
parent | 57706ce2f74622c9168de86fd4d23451cb30f67f (diff) | |
download | chromium_src-c3af62bc97e3aa9b1a135fcea9b6579e0d209715.zip chromium_src-c3af62bc97e3aa9b1a135fcea9b6579e0d209715.tar.gz chromium_src-c3af62bc97e3aa9b1a135fcea9b6579e0d209715.tar.bz2 |
Stick tcmalloc heap stats on the stack before crashing due to OOM
This should make diagnosing OOM crashes a lot easier.
TEST=manually force OOM, check the stack
BUG=29351
Review URL: http://codereview.chromium.org/462030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/chrome_dll_main.cc')
-rw-r--r-- | chrome/app/chrome_dll_main.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index e83e07d..651ab1dc 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -80,6 +80,10 @@ #include "tools/memory_watcher/memory_watcher.h" #endif +#if defined(USE_TCMALLOC) +#include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" +#endif + extern int BrowserMain(const MainFunctionParams&); extern int RendererMain(const MainFunctionParams&); extern int PluginMain(const MainFunctionParams&); @@ -137,6 +141,13 @@ void PureCall() { } void OnNoMemory() { +#if defined(USE_TCMALLOC) + // Try to get some information on the stack to make the crash easier to + // diagnose from a minidump, being very careful not to do anything that might + // try to heap allocate. + char buf[32*1024]; + MallocExtension::instance()->GetStats(buf, sizeof(buf)); +#endif // Kill the process. This is important for security, since WebKit doesn't // NULL-check many memory allocations. If a malloc fails, returns NULL, and // the buffer is then used, it provides a handy mapping of memory starting at |