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 234127 8a10855baef15502b357a82c65301601786252bb
parent 234126 17195f059d650b1be8e2dddfb659afa3379ab740
child 234128 1b663f223d0eb49d3d5d36ce05fe376db7903dea
push id208
push userryanvm@gmail.com
push dateMon, 23 Feb 2015 15:44:39 +0000
treeherdermozilla-b2g37_v2_2@09dafeb43234 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, lsblakk
bugs943051
milestone26.0
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
@@ -715,32 +715,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(NULL, kReserveSize, MEM_RESERVE, 0);
+    gBreakpadReservedVM = VirtualAlloc(NULL, 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.