Revert "linker: Purge block allocator memory when possible"
This reverts commit fb78a4ac1b93218f59aa44089ae5f4dbfababf0d.
Reason for revert: Performance regression.
Change-Id: Ib12335fc7478dad933da00b8bc525366c9330a17
diff --git a/linker/linker_block_allocator.cpp b/linker/linker_block_allocator.cpp
index 27f1e38..d72cad3 100644
--- a/linker/linker_block_allocator.cpp
+++ b/linker/linker_block_allocator.cpp
@@ -55,8 +55,7 @@
: block_size_(
round_up(block_size < sizeof(FreeBlockInfo) ? sizeof(FreeBlockInfo) : block_size, 16)),
page_list_(nullptr),
- free_block_list_(nullptr),
- allocated_(0)
+ free_block_list_(nullptr)
{}
void* LinkerBlockAllocator::alloc() {
@@ -77,8 +76,6 @@
memset(block_info, 0, block_size_);
- ++allocated_;
-
return block_info;
}
@@ -107,11 +104,6 @@
block_info->num_free_blocks = 1;
free_block_list_ = block_info;
-
- --allocated_;
- if (allocated_ == 0) {
- free_all_pages();
- }
}
void LinkerBlockAllocator::protect_all(int prot) {
@@ -162,18 +154,3 @@
abort();
}
-
-void LinkerBlockAllocator::free_all_pages() {
- if (allocated_) {
- abort();
- }
-
- LinkerBlockAllocatorPage* page = page_list_;
- while (page) {
- LinkerBlockAllocatorPage* next = page->next;
- munmap(page, kAllocateSize);
- page = next;
- }
- page_list_ = nullptr;
- free_block_list_ = nullptr;
-}