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

Side by Side Diff: third_party/tcmalloc/win_allocator.cc

Issue 165275: Major changes to the Chrome allocator.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « third_party/tcmalloc/tcmalloc.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This is a simple allocator based on the windows heap.
6
7 extern "C" {
8
9 HANDLE win_heap;
10
11 bool win_heap_init(bool use_lfh) {
12 win_heap = HeapCreate(0, 0, 0);
13 if (win_heap == NULL)
14 return false;
15
16 if (use_lfh) {
17 ULONG enable_lfh = 2;
18 HeapSetInformation(win_heap, HeapCompatibilityInformation,
19 &enable_lfh, sizeof(enable_lfh));
20 // NOTE: Setting LFH may fail. Vista already has it enabled.
21 // And under the debugger, it won't use LFH. So we
22 // ignore any errors.
23 }
24
25 return true;
26 }
27
28 void* win_heap_malloc(size_t s) {
29 return HeapAlloc(win_heap, 0, s);
30 }
31
32 void* win_heap_realloc(void* p, size_t s) {
33 if (!p)
34 return win_heap_malloc(s);
35 return HeapReAlloc(win_heap, 0, p, s);
36 }
37
38 void win_heap_free(void* s) {
39 HeapFree(win_heap, 0, s);
40 }
41
42 size_t win_heap_msize(void* p) {
43 return HeapSize(win_heap, 0, p);
44 }
45
46 } // extern "C"
OLDNEW
« no previous file with comments | « third_party/tcmalloc/tcmalloc.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698