From e3716145cbfa1247fa37dd627b2136a061944255 Mon Sep 17 00:00:00 2001 From: "alkondratenko@gmail.com" Date: Fri, 26 Jul 2013 18:19:05 +0000 Subject: issue-552: Fix page_heap_test for system with different page size This is patch by Adhemerval Zanella. PowerPC uses 64K page size instead of 4k for x86 and x86_64. It makes the page_heap_test fails because the following test: static bool HaveSystemRelease = TCMalloc_SystemRelease(TCMalloc_SystemAlloc(kPageSize, NULL, 0), kPageSize); will always fail if kPageSize is less than getpagesize() (the default configuration). The following patch fixes it by trying to allocate/deallocate an entire page instead. git-svn-id: http://gperftools.googlecode.com/svn/trunk@228 6b5cf1ce-ec42-a296-1ba9-69fdba395a50 --- src/tests/page_heap_test.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tests/page_heap_test.cc b/src/tests/page_heap_test.cc index 5bd803d..817b69b 100644 --- a/src/tests/page_heap_test.cc +++ b/src/tests/page_heap_test.cc @@ -12,8 +12,11 @@ DECLARE_int64(tcmalloc_heap_limit_mb); namespace { +// The system will only release memory if the block size is equal or hight than +// system page size. static bool HaveSystemRelease = - TCMalloc_SystemRelease(TCMalloc_SystemAlloc(kPageSize, NULL, 0), kPageSize); + TCMalloc_SystemRelease( + TCMalloc_SystemAlloc(getpagesize(), NULL, 0), getpagesize()); static void CheckStats(const tcmalloc::PageHeap* ph, uint64_t system_pages, -- cgit v1.2.1