OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |