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 #include "base/process/memory.h" | 5 #include "base/process/memory.h" |
6 | 6 |
7 #include <new> | 7 #include <new> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 std::string score_str = IntToString(converted_score); | 192 std::string score_str = IntToString(converted_score); |
193 DVLOG(1) << "Adjusting oom_adj of " << process << " to " << score_str; | 193 DVLOG(1) << "Adjusting oom_adj of " << process << " to " << score_str; |
194 int score_len = static_cast<int>(score_str.length()); | 194 int score_len = static_cast<int>(score_str.length()); |
195 return (score_len == WriteFile(oom_file, score_str.c_str(), score_len)); | 195 return (score_len == WriteFile(oom_file, score_str.c_str(), score_len)); |
196 } | 196 } |
197 | 197 |
198 return false; | 198 return false; |
199 } | 199 } |
200 | 200 |
201 bool UncheckedMalloc(size_t size, void** result) { | 201 bool UncheckedMalloc(size_t size, void** result) { |
202 #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \ | 202 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || \ |
203 defined(THREAD_SANITIZER) || defined(LEAK_SANITIZER) || \ | |
204 (!defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)) | 203 (!defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)) |
205 *result = malloc(size); | 204 *result = malloc(size); |
206 #elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC) | 205 #elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC) |
207 *result = __libc_malloc(size); | 206 *result = __libc_malloc(size); |
208 #elif defined(USE_TCMALLOC) | 207 #elif defined(USE_TCMALLOC) |
209 *result = tc_malloc_skip_new_handler_weak(size); | 208 *result = tc_malloc_skip_new_handler_weak(size); |
210 #endif | 209 #endif |
211 return *result != NULL; | 210 return *result != NULL; |
212 } | 211 } |
213 | 212 |
214 } // namespace base | 213 } // namespace base |
OLD | NEW |