Home | History | Annotate | only in /external/chromium_org/base/allocator
Up to higher level directory
NameDateSize
allocator.gyp10-Mar-201524.1K
allocator_extension.cc16-Dec-20141.9K
allocator_extension.h16-Dec-20142.1K
allocator_extension_thunks.cc16-Dec-20141.7K
allocator_extension_thunks.h16-Dec-20141.2K
allocator_extension_thunks.target.darwin-arm.mk10-Mar-20156.6K
allocator_extension_thunks.target.darwin-arm64.mk10-Mar-20156.1K
allocator_extension_thunks.target.darwin-mips.mk10-Mar-20156.3K
allocator_extension_thunks.target.darwin-mips64.mk10-Mar-20156.3K
allocator_extension_thunks.target.darwin-x86.mk10-Mar-20156.3K
allocator_extension_thunks.target.darwin-x86_64.mk10-Mar-20156.3K
allocator_extension_thunks.target.linux-arm.mk10-Mar-20156.6K
allocator_extension_thunks.target.linux-arm64.mk10-Mar-20156.1K
allocator_extension_thunks.target.linux-mips.mk10-Mar-20156.3K
allocator_extension_thunks.target.linux-mips64.mk10-Mar-20156.3K
allocator_extension_thunks.target.linux-x86.mk10-Mar-20156.3K
allocator_extension_thunks.target.linux-x86_64.mk10-Mar-20156.3K
allocator_shim.cc10-Mar-201510.9K
allocator_shim.h16-Dec-2014903
allocator_unittest.cc10-Mar-201516.1K
BUILD.gn10-Mar-20158.5K
debugallocation_shim.cc16-Dec-2014346
generic_allocators.cc10-Mar-20153.9K
prep_libc.py16-Dec-20142.5K
README16-Dec-20142.1K
tcmalloc_unittest.cc16-Dec-20143K
type_profiler.cc16-Dec-20141.7K
type_profiler.h16-Dec-20141.2K
type_profiler_control.cc16-Dec-2014774
type_profiler_control.h16-Dec-2014842
type_profiler_map_unittest.cc16-Dec-20142.8K
type_profiler_tcmalloc.cc16-Dec-20141K
type_profiler_tcmalloc.h16-Dec-2014853
type_profiler_unittest.cc16-Dec-20145.2K
unittest_utils.cc16-Dec-2014518
win_allocator.cc16-Dec-20142.1K

README

      1 Notes about the Chrome memory allocator.
      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 This directory contains just the allocator (i.e. shim) layer that switches
     24 between the different underlying memory allocation implementations.
     25 
     26 The tcmalloc and jemalloc libraries originate outside of Chromium
     27 and exist in ../../third_party/tcmalloc and ../../third_party/jemalloc
     28 (currently, the actual locations are defined in the allocator.gyp file).
     29 The third party sources use a vendor-branch SCM pattern to track
     30 Chromium-specific changes independently from upstream changes.
     31 
     32 The general intent is to push local changes upstream so that over
     33 time we no longer need any forked files.
     34 
     35 
     36 Adding a new allocator
     37 ----------------------
     38 Adding a new allocator requires definition of the following five functions:
     39 
     40   extern "C" {
     41     bool init();
     42     void* malloc(size_t s);
     43     void* realloc(void* p, size_t s);
     44     void free(void* s);
     45     size_t msize(void* p);
     46   }
     47 
     48 All other allocation related functions (new/delete/calloc/etc) have been
     49 implemented generically to work across all allocators.
     50 
     51 
     52 Usage
     53 -----
     54 You can use the different allocators by setting the environment variable
     55 CHROME_ALLOCATOR to:
     56    "tcmalloc"  - TC Malloc (default)
     57    "jemalloc"  - JE Malloc
     58    "winheap"   - Windows default heap
     59    "winlfh"    - Windows Low-Fragmentation heap
     60