Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc
Show First 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | void InternalFree(void *addr, InternalAllocatorCache *cache) { | ||||
((u64*)addr)[0] = 0; | ((u64*)addr)[0] = 0; | ||||
RawInternalFree(addr, cache); | RawInternalFree(addr, cache); | ||||
} | } | ||||
// LowLevelAllocator | // LowLevelAllocator | ||||
static LowLevelAllocateCallback low_level_alloc_callback; | static LowLevelAllocateCallback low_level_alloc_callback; | ||||
void *LowLevelAllocator::Allocate(uptr size) { | void *LowLevelAllocator::Allocate(uptr size) { | ||||
// Align allocation size. | // Align allocation size. Must be aligned to maximum supported | ||||
size = RoundUpTo(size, 8); | // shadow granularity. | ||||
size = RoundUpTo(size, 32); | |||||
if (allocated_end_ - allocated_current_ < (sptr)size) { | if (allocated_end_ - allocated_current_ < (sptr)size) { | ||||
uptr size_to_allocate = Max(size, GetPageSizeCached()); | uptr size_to_allocate = Max(size, GetPageSizeCached()); | ||||
allocated_current_ = | allocated_current_ = | ||||
(char*)MmapOrDie(size_to_allocate, __func__); | (char*)MmapOrDie(size_to_allocate, __func__); | ||||
allocated_end_ = allocated_current_ + size_to_allocate; | allocated_end_ = allocated_current_ + size_to_allocate; | ||||
if (low_level_alloc_callback) { | if (low_level_alloc_callback) { | ||||
low_level_alloc_callback((uptr)allocated_current_, | low_level_alloc_callback((uptr)allocated_current_, | ||||
size_to_allocate); | size_to_allocate); | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |