X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fheap.c;h=d091f51fbf2bf3689b846ce649dd6eb0787a635a;hb=4bcd721954ccf5120ddf0aa9930f15ca27aa6d88;hp=6bca486c458f5575b01d57ba8995e0efa50bd4a0;hpb=846a95f687048775d8572b62ffc839d0fcc009f4;p=platform%2Fcore%2Fsystem%2Ftizen-platform-wrapper.git diff --git a/src/heap.c b/src/heap.c index 6bca486..d091f51 100644 --- a/src/heap.c +++ b/src/heap.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Intel Corporation. + * Copyright (C) 2013-2014 Intel Corporation. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -45,9 +45,13 @@ inline static size_t align(size_t size) /* align to a page size */ inline static size_t pagealign( size_t size) { + static size_t pagemask = 0; /* we assume that pagesize is a power of 2 */ - size_t pagemask = (size_t)sysconf(_SC_PAGE_SIZE) - 1; - assert( (pagemask & (pagemask+1)) == 0 ); + if (!pagemask) { + pagemask = (size_t)sysconf(_SC_PAGE_SIZE) - 1; + assert( pagemask ); + assert( (pagemask & (pagemask+1)) == 0 ); + } return (size + pagemask) & ~pagemask; }