| OLD | NEW |
| 1 // Copyright (c) 2007, Google Inc. | 1 // Copyright (c) 2007, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 DEFINE_string(memfs_malloc_path, EnvToString("TCMALLOC_MEMFS_MALLOC_PATH", ""), | 69 DEFINE_string(memfs_malloc_path, EnvToString("TCMALLOC_MEMFS_MALLOC_PATH", ""), |
| 70 "Path where hugetlbfs or tmpfs is mounted. The caller is " | 70 "Path where hugetlbfs or tmpfs is mounted. The caller is " |
| 71 "responsible for ensuring that the path is unique and does " | 71 "responsible for ensuring that the path is unique and does " |
| 72 "not conflict with another process"); | 72 "not conflict with another process"); |
| 73 DEFINE_int64(memfs_malloc_limit_mb, | 73 DEFINE_int64(memfs_malloc_limit_mb, |
| 74 EnvToInt("TCMALLOC_MEMFS_LIMIT_MB", 0), | 74 EnvToInt("TCMALLOC_MEMFS_LIMIT_MB", 0), |
| 75 "Limit total allocation size to the " | 75 "Limit total allocation size to the " |
| 76 "specified number of MiB. 0 == no limit."); | 76 "specified number of MiB. 0 == no limit."); |
| 77 DEFINE_bool(memfs_malloc_abort_on_fail, | 77 DEFINE_bool(memfs_malloc_abort_on_fail, |
| 78 EnvToBool("TCMALLOC_MEMFS_ABORT_ON_FAIL", false), | 78 EnvToBool("TCMALLOC_MEMFS_ABORT_ON_FAIL", false), |
| 79 "abort() whenever memfs_malloc fails to satisfy an allocation " | 79 "abort whenever memfs_malloc fails to satisfy an allocation " |
| 80 "for any reason."); | 80 "for any reason."); |
| 81 DEFINE_bool(memfs_malloc_ignore_mmap_fail, | 81 DEFINE_bool(memfs_malloc_ignore_mmap_fail, |
| 82 EnvToBool("TCMALLOC_MEMFS_IGNORE_MMAP_FAIL", false), | 82 EnvToBool("TCMALLOC_MEMFS_IGNORE_MMAP_FAIL", false), |
| 83 "Ignore failures from mmap"); | 83 "Ignore failures from mmap"); |
| 84 DEFINE_bool(memfs_malloc_map_private, | 84 DEFINE_bool(memfs_malloc_map_private, |
| 85 EnvToBool("TCMALLOC_MEMFS_MAP_PRIVATE", false), | 85 EnvToBool("TCMALLOC_MEMFS_MAP_PRIVATE", false), |
| 86 "Use MAP_PRIVATE with mmap"); | 86 "Use MAP_PRIVATE with mmap"); |
| 87 | 87 |
| 88 // Hugetlbfs based allocator for tcmalloc | 88 // Hugetlbfs based allocator for tcmalloc |
| 89 class HugetlbSysAllocator: public SysAllocator { | 89 class HugetlbSysAllocator: public SysAllocator { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (FLAGS_memfs_malloc_path.length()) { | 258 if (FLAGS_memfs_malloc_path.length()) { |
| 259 SysAllocator* alloc = MallocExtension::instance()->GetSystemAllocator(); | 259 SysAllocator* alloc = MallocExtension::instance()->GetSystemAllocator(); |
| 260 HugetlbSysAllocator* hp = new (hugetlb_space) HugetlbSysAllocator(alloc); | 260 HugetlbSysAllocator* hp = new (hugetlb_space) HugetlbSysAllocator(alloc); |
| 261 if (hp->Initialize()) { | 261 if (hp->Initialize()) { |
| 262 MallocExtension::instance()->SetSystemAllocator(hp); | 262 MallocExtension::instance()->SetSystemAllocator(hp); |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 }); | 265 }); |
| 266 | 266 |
| 267 #endif /* ifdef __linux */ | 267 #endif /* ifdef __linux */ |
| OLD | NEW |