| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef BASE_PROCESS_MEMORY_H_ | 5 #ifndef BASE_PROCESS_MEMORY_H_ |
| 6 #define BASE_PROCESS_MEMORY_H_ | 6 #define BASE_PROCESS_MEMORY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // overflow. Has no effect if the OS doesn't provide the necessary facility. | 25 // overflow. Has no effect if the OS doesn't provide the necessary facility. |
| 26 BASE_EXPORT void EnableTerminationOnHeapCorruption(); | 26 BASE_EXPORT void EnableTerminationOnHeapCorruption(); |
| 27 | 27 |
| 28 // Turns on process termination if memory runs out. | 28 // Turns on process termination if memory runs out. |
| 29 BASE_EXPORT void EnableTerminationOnOutOfMemory(); | 29 BASE_EXPORT void EnableTerminationOnOutOfMemory(); |
| 30 | 30 |
| 31 // Terminates process. Should be called only for out of memory errors. | 31 // Terminates process. Should be called only for out of memory errors. |
| 32 // Crash reporting classifies such crashes as OOM. | 32 // Crash reporting classifies such crashes as OOM. |
| 33 BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size); | 33 BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size); |
| 34 | 34 |
| 35 #if defined(OS_LINUX) || defined(OS_ANDROID) | 35 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_AIX) |
| 36 BASE_EXPORT extern size_t g_oom_size; | 36 BASE_EXPORT extern size_t g_oom_size; |
| 37 | 37 |
| 38 // The maximum allowed value for the OOM score. | 38 // The maximum allowed value for the OOM score. |
| 39 const int kMaxOomScore = 1000; | 39 const int kMaxOomScore = 1000; |
| 40 | 40 |
| 41 // This adjusts /proc/<pid>/oom_score_adj so the Linux OOM killer will | 41 // This adjusts /proc/<pid>/oom_score_adj so the Linux OOM killer will |
| 42 // prefer to kill certain process types over others. The range for the | 42 // prefer to kill certain process types over others. The range for the |
| 43 // adjustment is [-1000, 1000], with [0, 1000] being user accessible. | 43 // adjustment is [-1000, 1000], with [0, 1000] being user accessible. |
| 44 // If the Linux system doesn't support the newer oom_score_adj range | 44 // If the Linux system doesn't support the newer oom_score_adj range |
| 45 // of [0, 1000], then we revert to using the older oom_adj, and | 45 // of [0, 1000], then we revert to using the older oom_adj, and |
| (...skipping 28 matching lines...) Expand all Loading... |
| 74 // set to NULL, otherwise it holds the memory address. | 74 // set to NULL, otherwise it holds the memory address. |
| 75 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size, | 75 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size, |
| 76 void** result); | 76 void** result); |
| 77 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items, | 77 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items, |
| 78 size_t size, | 78 size_t size, |
| 79 void** result); | 79 void** result); |
| 80 | 80 |
| 81 } // namespace base | 81 } // namespace base |
| 82 | 82 |
| 83 #endif // BASE_PROCESS_MEMORY_H_ | 83 #endif // BASE_PROCESS_MEMORY_H_ |
| OLD | NEW |