Skip to content

Commit

Permalink
Fixing the rounding of page sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
tesonep committed Apr 5, 2022
1 parent 4b68039 commit 1870c61
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/memoryUnix.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,17 @@ sqAllocateMemory(usqInt minHeapSize, usqInt desiredHeapSize, usqInt desiredBaseA
pageSize = getpagesize();
pageMask = ~(pageSize - 1);

heapLimit = valign(max(desiredHeapSize, 1)) + pageSize; // Add 1 page more just in case (G & N)
logDebug("Requested Size %d", desiredHeapSize);

heapLimit = valign(max(desiredHeapSize, 1));
if(heapLimit < desiredHeapSize){
heapLimit += pageSize;
}

usqInt desiredBaseAddressAligned = valign(desiredBaseAddress);

logDebug("Aligned Requested Size %d", heapLimit);

logDebug("Trying to load the image in %p\n",
(void* )desiredBaseAddressAligned);

Expand Down

0 comments on commit 1870c61

Please sign in to comment.