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

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

Issue 1825823002: Cleanup: LFH only needs to be enabled on XP/2003 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 4 years, 8 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"
11 #include "base/process/process_handle.h" 11 #include "base/process/process_handle.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 13
14 #if defined(OS_WIN) 14 #if defined(OS_WIN)
15 #include <windows.h> 15 #include <windows.h>
16 #endif 16 #endif
17 17
18 #ifdef PVALLOC_AVAILABLE 18 #ifdef PVALLOC_AVAILABLE
19 // Build config explicitly tells us whether or not pvalloc is available. 19 // Build config explicitly tells us whether or not pvalloc is available.
20 #elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC) 20 #elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)
21 #define PVALLOC_AVAILABLE 1 21 #define PVALLOC_AVAILABLE 1
22 #else 22 #else
23 #define PVALLOC_AVAILABLE 0 23 #define PVALLOC_AVAILABLE 0
24 #endif 24 #endif
25 25
26 namespace base { 26 namespace base {
27 27
28 // Enables low fragmentation heap (LFH) for every heaps of this process. This
29 // won't have any effect on heaps created after this function call. It will not
30 // modify data allocated in the heaps before calling this function. So it is
31 // better to call this function early in initialization and again before
32 // entering the main loop.
33 // Note: Returns true on Windows 2000 without doing anything.
34 BASE_EXPORT bool EnableLowFragmentationHeap();
35
36 // Enables 'terminate on heap corruption' flag. Helps protect against heap 28 // Enables 'terminate on heap corruption' flag. Helps protect against heap
37 // overflow. Has no effect if the OS doesn't provide the necessary facility. 29 // overflow. Has no effect if the OS doesn't provide the necessary facility.
38 BASE_EXPORT void EnableTerminationOnHeapCorruption(); 30 BASE_EXPORT void EnableTerminationOnHeapCorruption();
39 31
40 // Turns on process termination if memory runs out. 32 // Turns on process termination if memory runs out.
41 BASE_EXPORT void EnableTerminationOnOutOfMemory(); 33 BASE_EXPORT void EnableTerminationOnOutOfMemory();
42 34
43 // Terminates process. Should be called only for out of memory errors. 35 // Terminates process. Should be called only for out of memory errors.
44 // Crash reporting classifies such crashes as OOM. 36 // Crash reporting classifies such crashes as OOM.
45 BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size); 37 BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // set to NULL, otherwise it holds the memory address. 70 // set to NULL, otherwise it holds the memory address.
79 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size, 71 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedMalloc(size_t size,
80 void** result); 72 void** result);
81 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items, 73 BASE_EXPORT WARN_UNUSED_RESULT bool UncheckedCalloc(size_t num_items,
82 size_t size, 74 size_t size,
83 void** result); 75 void** result);
84 76
85 } // namespace base 77 } // namespace base
86 78
87 #endif // BASE_PROCESS_MEMORY_H_ 79 #endif // BASE_PROCESS_MEMORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698