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

Side by Side Diff: base/process/memory.h

Issue 2130293003: Change OOMs to raise custom exception rather than breakpoint on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: formatting. code review fix. Created 4 years, 5 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
OLDNEW
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 30 matching lines...) Expand all
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
46 // translate the given value into [0, 15]. Some aliasing of values 46 // translate the given value into [0, 15]. Some aliasing of values
47 // may occur in that case, of course. 47 // may occur in that case, of course.
48 BASE_EXPORT bool AdjustOOMScore(ProcessId process, int score); 48 BASE_EXPORT bool AdjustOOMScore(ProcessId process, int score);
49 #endif 49 #endif
50 50
51 #if defined(OS_WIN)
52 namespace win {
53
54 const DWORD kOomExceptionCode = 0xE0000008;
Mark Mentovai 2016/07/19 20:32:08 A quick comment on how this is expected to be used
Will Harris 2016/07/19 21:35:32 Done.
55
56 } // namespace win
57 #endif
58
51 // Special allocator functions for callers that want to check for OOM. 59 // Special allocator functions for callers that want to check for OOM.
52 // These will not abort if the allocation fails even if 60 // These will not abort if the allocation fails even if
53 // EnableTerminationOnOutOfMemory has been called. 61 // EnableTerminationOnOutOfMemory has been called.
54 // This can be useful for huge and/or unpredictable size memory allocations. 62 // This can be useful for huge and/or unpredictable size memory allocations.
55 // Please only use this if you really handle the case when the allocation 63 // Please only use this if you really handle the case when the allocation
56 // fails. Doing otherwise would risk security. 64 // fails. Doing otherwise would risk security.
57 // These functions may still crash on OOM when running under memory tools, 65 // These functions may still crash on OOM when running under memory tools,
58 // specifically ASan and other sanitizers. 66 // specifically ASan and other sanitizers.
59 // Return value tells whether the allocation succeeded. If it fails |result| is 67 // Return value tells whether the allocation succeeded. If it fails |result| is
60 // set to NULL, otherwise it holds the memory address. 68 // set to NULL, otherwise it holds the memory address.
61 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size, 69 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size,
62 void** result); 70 void** result);
63 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items, 71 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items,
64 size_t size, 72 size_t size,
65 void** result); 73 void** result);
66 74
67 } // namespace base 75 } // namespace base
68 76
69 #endif // BASE_PROCESS_MEMORY_H_ 77 #endif // BASE_PROCESS_MEMORY_H_
OLDNEW
« no previous file with comments | « no previous file | base/process/memory_unittest.cc » ('j') | third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698