mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-22 13:29:01 +00:00
src/runtime: improve metadatasize calculation to avoid rounding issues
This commit is contained in:
@@ -240,7 +240,7 @@ func calculateHeapAddresses() {
|
|||||||
totalSize := heapEnd - heapStart
|
totalSize := heapEnd - heapStart
|
||||||
|
|
||||||
// Allocate some memory to keep 2 bits of information about every block.
|
// Allocate some memory to keep 2 bits of information about every block.
|
||||||
metadataSize := totalSize / (blocksPerStateByte * bytesPerBlock)
|
metadataSize := (totalSize + blocksPerStateByte*bytesPerBlock) / (1 + blocksPerStateByte*bytesPerBlock)
|
||||||
metadataStart = unsafe.Pointer(heapEnd - metadataSize)
|
metadataStart = unsafe.Pointer(heapEnd - metadataSize)
|
||||||
|
|
||||||
// Use the rest of the available memory as heap.
|
// Use the rest of the available memory as heap.
|
||||||
|
|||||||
Reference in New Issue
Block a user