Bug 943051 - Fix VirtualAlloc and VirtualFree flags for gBreakpadReservedVM. r=bsmedberg, a=lsblakk
authorDavid Major <dmajor@mozilla.com>
Tue, 26 Nov 2013 13:22:01 -0500
changeset 167596 0b4d1b22e6e8e84ecd5f56a4f31499af0f2e93da
parent 167595 72560d160a16a49e8245cce3507d7598834e87c6
child 167597 ffd436abd69e8afc86abb2a3fcda35a748bae635
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, lsblakk
bugs943051
milestone27.0a2
Bug 943051 - Fix VirtualAlloc and VirtualFree flags for gBreakpadReservedVM. r=bsmedberg, a=lsblakk
toolkit/crashreporter/nsExceptionHandler.cpp
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -714,32 +714,36 @@ bool MinidumpCallback(
 
 #ifdef XP_WIN
 static void* gBreakpadReservedVM;
 
 /**
  * Reserve some VM space. In the event that we crash because VM space is
  * being leaked without leaking memory, freeing this space before taking
  * the minidump will allow us to collect a minidump.
+ *
+ * This size is bigger than xul.dll plus some extra for MinidumpWriteDump
+ * allocations.
  */
-static const SIZE_T kReserveSize = 0xc00000; // 12 MB
+static const SIZE_T kReserveSize = 0x2400000; // 36 MB
 
 static void
 ReserveBreakpadVM()
 {
   if (!gBreakpadReservedVM) {
-    gBreakpadReservedVM = VirtualAlloc(nullptr, kReserveSize, MEM_RESERVE, 0);
+    gBreakpadReservedVM = VirtualAlloc(nullptr, kReserveSize, MEM_RESERVE,
+                                       PAGE_NOACCESS);
   }
 }
 
 static void
 FreeBreakpadVM()
 {
   if (gBreakpadReservedVM) {
-    VirtualFree(gBreakpadReservedVM, kReserveSize, MEM_RELEASE);
+    VirtualFree(gBreakpadReservedVM, 0, MEM_RELEASE);
   }
 }
 
 /**
  * Filters out floating point exceptions which are handled by nsSigHandlers.cpp
  * and should not be handled as crashes.
  *
  * Also calls FreeBreakpadVM if appropriate.