|
From: <sv...@va...> - 2012-10-21 21:03:19
|
philippe 2012-10-21 22:03:11 +0100 (Sun, 21 Oct 2012)
New Revision: 13077
Log:
Fix 308711 - give more info about aspacemgr and arenas in out_of_memory
In case of out of memory, Valgrind will output
the state of the address space manager and of the arena.
Then it will output a message to inform the user about the out of memory.
In case out of memory happens again while outputting the aspacemgr
or arena info, then another trial is done to only output the user msg.
Modified files:
trunk/NEWS
trunk/coregrind/m_mallocfree.c
Modified: trunk/NEWS (+1 -0)
===================================================================
--- trunk/NEWS 2012-10-21 21:21:17 +01:00 (rev 13076)
+++ trunk/NEWS 2012-10-21 22:03:11 +01:00 (rev 13077)
@@ -38,6 +38,7 @@
308321 [390] testsuite memcheck filter interferes with gdb_filter
308341 [390] vgdb should report process exit (or fatal signal)
308644 [390] vgdb command for having the info for the track-fds option
+308711 [390] give more info about aspacemgr and arenas in out_of_memory
n-i-bz [390] report error for vgdb snapshot requested before execution
n-i-bz [390] Some wrong command line options could be ignored
Modified: trunk/coregrind/m_mallocfree.c (+15 -3)
===================================================================
--- trunk/coregrind/m_mallocfree.c 2012-10-21 21:21:17 +01:00 (rev 13076)
+++ trunk/coregrind/m_mallocfree.c 2012-10-21 22:03:11 +01:00 (rev 13077)
@@ -704,7 +704,12 @@
__attribute__((noreturn))
void VG_(out_of_memory_NORETURN) ( HChar* who, SizeT szB )
{
- static Bool alreadyCrashing = False;
+ static Int outputTrial = 0;
+ // We try once to output the full memory state followed by the below message.
+ // If that fails (due to out of memory during first trial), we try to just
+ // output the below message.
+ // And then we abandon.
+
ULong tot_alloc = VG_(am_get_anonsize_total)();
Char* s1 =
"\n"
@@ -729,8 +734,15 @@
" 3GB per process.\n\n"
" Whatever the reason, Valgrind cannot continue. Sorry.\n";
- if (!alreadyCrashing) {
- alreadyCrashing = True;
+ if (outputTrial <= 1) {
+ if (outputTrial == 0) {
+ outputTrial++;
+ VG_(am_show_nsegments) (0, "out_of_memory");
+ VG_(print_all_arena_stats) ();
+ if (VG_(clo_profile_heap))
+ VG_(print_arena_cc_analysis) ();
+ }
+ outputTrial++;
VG_(message)(Vg_UserMsg, s1, who, (ULong)szB, tot_alloc);
} else {
VG_(debugLog)(0,"mallocfree", s1, who, (ULong)szB, tot_alloc);
|