Source file src/runtime/_mkmalloc/constants.go
1 // Copyright 2025 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 const ( 8 // Constants that we use and will transfer to the runtime. 9 minHeapAlign = 8 10 maxSmallSize = 32 << 10 11 smallSizeDiv = 8 12 smallSizeMax = 1024 13 largeSizeDiv = 128 14 pageShift = 13 15 tinySize = 16 16 17 // Derived constants. 18 pageSize = 1 << pageShift 19 ) 20 21 const ( 22 maxPtrSize = max(4, 8) 23 maxPtrBits = 8 * maxPtrSize 24 25 // Maximum size smallScanNoHeader would be called for, which is the 26 // maximum value gc.MinSizeForMallocHeader can have on any platform. 27 // gc.MinSizeForMallocHeader is defined as goarch.PtrSize * goarch.PtrBits. 28 smallScanNoHeaderMax = maxPtrSize * maxPtrBits 29 ) 30