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

Unified Diff: base/process/memory_win.cc

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, 9 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 side-by-side diff with in-line comments
Download patch
Index: base/process/memory_win.cc
diff --git a/base/process/memory_win.cc b/base/process/memory_win.cc
index 42f707d9ac0102df377fbe2b2c075b34edcfeca2..979a66e193d45862f60a11756885b1d2ad07dd9b 100644
--- a/base/process/memory_win.cc
+++ b/base/process/memory_win.cc
@@ -50,41 +50,6 @@ typedef BOOL (WINAPI* HeapSetFn)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T);
} // namespace
-bool EnableLowFragmentationHeap() {
- HMODULE kernel32 = GetModuleHandle(L"kernel32.dll");
- HeapSetFn heap_set = reinterpret_cast<HeapSetFn>(GetProcAddress(
- kernel32,
- "HeapSetInformation"));
-
- // On Windows 2000, the function is not exported. This is not a reason to
- // fail.
- if (!heap_set)
- return true;
-
- unsigned number_heaps = GetProcessHeaps(0, NULL);
- if (!number_heaps)
- return false;
-
- // Gives us some extra space in the array in case a thread is creating heaps
- // at the same time we're querying them.
- static const int MARGIN = 8;
- scoped_ptr<HANDLE[]> heaps(new HANDLE[number_heaps + MARGIN]);
- number_heaps = GetProcessHeaps(number_heaps + MARGIN, heaps.get());
- if (!number_heaps)
- return false;
-
- for (unsigned i = 0; i < number_heaps; ++i) {
- ULONG lfh_flag = 2;
- // Don't bother with the result code. It may fails on heaps that have the
- // HEAP_NO_SERIALIZE flag. This is expected and not a problem at all.
- heap_set(heaps[i],
- HeapCompatibilityInformation,
- &lfh_flag,
- sizeof(lfh_flag));
- }
- return true;
-}
-
void EnableTerminationOnHeapCorruption() {
// Ignore the result code. Supported on XP SP3 and Vista.
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

Powered by Google App Engine
This is Rietveld 408576698