github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/base/base.go (about)

     1  // Copyright 2009 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 base
     6  
     7  func AtExit(f func())
     8  
     9  func Exit(code int)
    10  
    11  // To enable tracing support (-t flag), set EnableTrace to true.
    12  const EnableTrace = false
    13  
    14  // AdjustStartingHeap modifies GOGC so that GC should not occur until the heap
    15  // grows to the requested size.  This is intended but not promised, though it
    16  // is true-mostly, depending on when the adjustment occurs and on the
    17  // compiler's input and behavior.  Once this size is approximately reached
    18  // GOGC is reset to 100; subsequent GCs may reduce the heap below the requested
    19  // size, but this function does not affect that.
    20  //
    21  // -d=gcadjust=1 enables logging of GOGC adjustment events.
    22  //
    23  // NOTE: If you think this code would help startup time in your own
    24  // application and you decide to use it, please benchmark first to see if it
    25  // actually works for you (it may not: the Go compiler is not typical), and
    26  // whatever the outcome, please leave a comment on bug #56546.  This code
    27  // uses supported interfaces, but depends more than we like on
    28  // current+observed behavior of the garbage collector, so if many people need
    29  // this feature, we should consider/propose a better way to accomplish it.
    30  func AdjustStartingHeap(requestedHeapGoal uint64)