Fix free pages count in LinkerSmallObjectAllocator
Free pages count should be incremented by 1 when a new page is
allocated. Without this fix, free pages count underflows and the
allocator ends up freeing a free page whenever the last object in that
page is freed. In other words, it doesn't hold onto a free page as
expected and thus we may see more mmap/munmap calls.
Test: Set breakpoint at the end of __linker_init and check
free_pages_cnt values are either 0 or 1.
Change-Id: I259a3a27329aab6835c21b4aa7ddda89dac9655b
diff --git a/linker/linker_allocator.cpp b/linker/linker_allocator.cpp
index de3309b..8b05a7e 100644
--- a/linker/linker_allocator.cpp
+++ b/linker/linker_allocator.cpp
@@ -222,6 +222,8 @@
first_block->free_blocks_cnt = free_blocks_cnt;
free_blocks_list_ = first_block;
+
+ free_pages_cnt_++;
}