Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: base/process_util_mac.mm

Issue 9597031: In CrMallocErrorBreak, do not kill the process if errno is ENOMEM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/process_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/process_util.h" 5 #include "base/process_util.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <crt_externs.h> 8 #include <crt_externs.h>
9 #include <dlfcn.h> 9 #include <dlfcn.h>
10 #include <errno.h> 10 #include <errno.h>
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 reference_addr += nl[0].n_value; 542 reference_addr += nl[0].n_value;
543 543
544 return reinterpret_cast<malloc_error_break_t>(reference_addr); 544 return reinterpret_cast<malloc_error_break_t>(reference_addr);
545 #endif // ARCH_CPU_32_BITS 545 #endif // ARCH_CPU_32_BITS
546 546
547 return NULL; 547 return NULL;
548 } 548 }
549 549
550 void CrMallocErrorBreak() { 550 void CrMallocErrorBreak() {
551 g_original_malloc_error_break(); 551 g_original_malloc_error_break();
552
553 // Out of memory is certainly not heap corruption, and not necessarily
554 // something for which the process should be terminated. Leave that decision
555 // to the OOM killer.
556 if (errno == ENOMEM)
557 return;
558
552 // A unit test checks this error message, so it needs to be in release builds. 559 // A unit test checks this error message, so it needs to be in release builds.
553 LOG(ERROR) << 560 LOG(ERROR) <<
554 "Terminating process due to a potential for future heap corruption"; 561 "Terminating process due to a potential for future heap corruption";
555 int* death_ptr = NULL; 562 int* death_ptr = NULL;
556 *death_ptr = 0xf00bad; 563 *death_ptr = 0xf00bad;
557 } 564 }
558 565
559 } // namespace 566 } // namespace
560 567
561 void EnableTerminationOnHeapCorruption() { 568 void EnableTerminationOnHeapCorruption() {
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 } 1150 }
1144 } 1151 }
1145 1152
1146 } // namespace 1153 } // namespace
1147 1154
1148 void EnsureProcessTerminated(ProcessHandle process) { 1155 void EnsureProcessTerminated(ProcessHandle process) {
1149 WaitForChildToDie(process, kWaitBeforeKillSeconds); 1156 WaitForChildToDie(process, kWaitBeforeKillSeconds);
1150 } 1157 }
1151 1158
1152 } // namespace base 1159 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698