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

Side by Side Diff: third_party/tcmalloc/README

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 | « no previous file | third_party/tcmalloc/allocator_shim.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 Notes about the Chrome port of tcmalloc & jemalloc.
2
3 Background
4 ----------
5 We use this library as a generic way to fork into any of several allocators.
6 Currently we can, at runtime, switch between:
7 the default windows allocator
8 the windows low-fragmentation-heap
9 tcmalloc
10 jemalloc (the heap used most notably within Mozilla Firefox)
11
12 The mechanism for hooking LIBCMT in windows is rather tricky. The core
13 problem is that by default, the windows library does not declare malloc and
14 free as weak symbols. Because of this, they cannot be overriden. To work
15 around this, we start with the LIBCMT.LIB, and manually remove all allocator
16 related functions from it using the visual studio library tool. Once removed,
17 we can now link against the library and provide custom versions of the
18 allocator related functionality.
19
20
21 Source code
22 -----------
23 Everything within the directory tcmalloc/tcmalloc is pulled directly from the
24 google-perftools repository. For the most part, tcmalloc is a stock build
25 from there.
26
27 We have forked a few files. We always push our changes upstream, so over
28 time the forked files should disappear. Currently forked files include:
29 page_heap.cc
30 port.cc
31 system-alloc.cc
32 system-alloc.h
33 tcmalloc.cc
34
35 Adding a new allocator requires definition of the following five functions:
36 extern "C" {
37 bool init();
38 void* malloc(size_t s);
39 void* realloc(void* p, size_t s);
40 void free(void* s);
41 size_t msize(void* p);
42 }
43
44 All other allocation related functions (new/delete/calloc/etc) have been
45 implemented generically to work across all allocators.
46
47
48 Usage
49 -----
50 You can use the different allocators by setting the environment variable
51 CHROME_ALLOCATOR to:
52 "tcmalloc" - TC Malloc (default)
53 "jemalloc" - JE Malloc
54 "winheap" - Windows default heap
55 "winlfh" - Windows Low-Fragmentation heap
56
57
58 Local modifications
59 -------------------
60 jemalloc has been modified slightly to work within the Chromium build.
OLDNEW
« no previous file with comments | « no previous file | third_party/tcmalloc/allocator_shim.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698