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 to generate size specialized functions for.
    26  	// We've seen very limited benefit for specialized functions for larger
    27  	// size classes, and with the wrapper they are sometimes slower
    28  	// than the non-specialized functions.
    29  	// This must match the constant in the compiler.
    30  	specializedMallocMax = 80
    31  )
    32  

View as plain text