]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Clarify the "out of memory" message.
authorNicholas Nethercote <njn@valgrind.org>
Thu, 22 Mar 2007 03:36:55 +0000 (03:36 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Thu, 22 Mar 2007 03:36:55 +0000 (03:36 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6656

coregrind/m_mallocfree.c

index 7484b2d82bc7060120760a07e0f20fc2ebf6fefb..5f97dd4f4ad39a34abd42b9944a073e863930919 100644 (file)
@@ -517,26 +517,34 @@ void VG_(out_of_memory_NORETURN) ( HChar* who, SizeT szB )
 {
    static Bool alreadyCrashing = False;
    ULong tot_alloc = VG_(am_get_anonsize_total)();
+   Char* s1 = 
+      "\n"
+      "    Valgrind's memory management: out of memory:\n"
+      "       %s's request for %llu bytes failed.\n"
+      "       %llu bytes have already been allocated.\n"
+      "    Valgrind cannot continue.  Sorry.\n\n"
+      "    There are several possible reasons for this.\n"
+      "    - You have some kind of memory limit in place.  Look at the\n"
+      "      output of 'ulimit -a'.  Is there a limit on the size of\n"
+      "      virtual memory or address space?\n"
+      "    - You have run out of swap space.\n"
+      "    - Valgrind has a bug.  If you think this is the case or you are\n"
+      "    not sure, please let us know and we'll try to fix it.\n"
+      "    Please note that programs can take substantially more memory than\n"
+      "    normal when running under Valgrind tools, eg. up to twice or\n"
+      "    more, depending on the tool.  On a 64-bit machine, Valgrind\n"
+      "    should be able to make use of up 32GB memory.  On a 32-bit\n"
+      "    machine, Valgrind should be able to use all the memory available\n"
+      "    to a single process, up to 4GB if that's how you have your\n"
+      "    kernel configured.  Most 32-bit Linux setups allow a maximum of\n"
+      "    3GB per process.\n\n"
+      "    Whatever the reason, Valgrind cannot continue.  Sorry.\n";
+
    if (!alreadyCrashing) {
       alreadyCrashing = True;
-      VG_(printf)("\n"
-                  "Valgrind's memory management: out of memory:\n");
-      VG_(printf)("   %s's request for %llu bytes failed.\n", 
-                  who, (ULong)szB );
-      VG_(printf)("   %llu bytes have already been allocated.\n", 
-                  tot_alloc);
-      VG_(printf)("Valgrind cannot continue.  Sorry.\n\n");
+      VG_(message)(Vg_UserMsg, s1, who, (ULong)szB, tot_alloc);
    } else {
-      VG_(debugLog)(0,"mallocfree","\n");
-      VG_(debugLog)(0,"mallocfree",
-                      "Valgrind's memory management: out of memory:\n");
-      VG_(debugLog)(0,"mallocfree",
-                      "   %s's request for %llu bytes failed.\n", 
-                      who, (ULong)szB );
-      VG_(debugLog)(0,"mallocfree",
-                      "   %llu bytes have already been allocated.\n", 
-                      tot_alloc);
-      VG_(debugLog)(0,"mallocfree","Valgrind cannot continue.  Sorry.\n\n");
+      VG_(debugLog)(0,"mallocfree", s1, who, (ULong)szB, tot_alloc);
    }
    VG_(exit)(1);
 }