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

Side by Side Diff: base/allocator/win_allocator.cc

Issue 55333002: Make possible to check memory allocations inside chromium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make possible to check memory allocations inside chromium Created 7 years, 1 month 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This is a simple allocator based on the windows heap. 5 // This is a simple allocator based on the windows heap.
6 6
7 #include "base/process/memory.h"
8
7 extern "C" { 9 extern "C" {
8 10
9 HANDLE win_heap; 11 HANDLE win_heap;
10 12
11 bool win_heap_init(bool use_lfh) { 13 bool win_heap_init(bool use_lfh) {
12 win_heap = HeapCreate(0, 0, 0); 14 win_heap = HeapCreate(0, 0, 0);
13 if (win_heap == NULL) 15 if (win_heap == NULL)
14 return false; 16 return false;
15 17
16 if (use_lfh) { 18 if (use_lfh) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 reinterpret_cast<void**>(aligned_ptr)[-1] = ptr; 71 reinterpret_cast<void**>(aligned_ptr)[-1] = ptr;
70 return aligned_ptr; 72 return aligned_ptr;
71 } 73 }
72 74
73 void win_heap_memalign_free(void* ptr) { 75 void win_heap_memalign_free(void* ptr) {
74 if (ptr) 76 if (ptr)
75 win_heap_free(static_cast<void**>(ptr)[-1]); 77 win_heap_free(static_cast<void**>(ptr)[-1]);
76 } 78 }
77 79
78 } // extern "C" 80 } // extern "C"
81
82 #if !defined(WIN_USE_ALLOCATOR_SHIM)
83
84 namespace base {
85 void* UncheckedMalloc(size_t size) {
86 return win_heap_malloc(size);
87 }
88 }
89
90 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698