5 #include "src/base/lsan-page-allocator.h" 7 #include "src/base/logging.h" 9 #if defined(LEAK_SANITIZER) 10 #include <sanitizer/lsan_interface.h> 17 : page_allocator_(page_allocator),
18 allocate_page_size_(page_allocator_->AllocatePageSize()),
19 commit_page_size_(page_allocator_->CommitPageSize()) {
20 DCHECK_NOT_NULL(page_allocator);
23 void* LsanPageAllocator::AllocatePages(
void* address,
size_t size,
27 page_allocator_->
AllocatePages(address, size, alignment, access);
28 #if defined(LEAK_SANITIZER) 29 if (result !=
nullptr) {
30 __lsan_register_root_region(result, size);
36 bool LsanPageAllocator::FreePages(
void* address,
size_t size) {
37 bool result = page_allocator_->
FreePages(address, size);
38 #if defined(LEAK_SANITIZER) 40 __lsan_unregister_root_region(address, size);
46 bool LsanPageAllocator::ReleasePages(
void* address,
size_t size,
48 bool result = page_allocator_->
ReleasePages(address, size, new_size);
49 #if defined(LEAK_SANITIZER) 51 __lsan_unregister_root_region(address, size);
52 __lsan_register_root_region(address, new_size);
virtual bool FreePages(void *address, size_t length)=0
virtual bool ReleasePages(void *address, size_t length, size_t new_length)=0
virtual void * AllocatePages(void *address, size_t length, size_t alignment, Permission permissions)=0