...

Source file src/github.com/onsi/gomega/gleak/goroutine/stack.go

Documentation: github.com/onsi/gomega/gleak/goroutine

     1  package goroutine
     2  
     3  import "runtime"
     4  
     5  const startStackBufferSize = 64 * 1024 // 64kB
     6  
     7  // stacks returns stack trace information for either all goroutines or only the
     8  // current goroutine. It is a convenience wrapper around runtime.Stack, hiding
     9  // the result allocation.
    10  func stacks(all bool) []byte {
    11  	for size := startStackBufferSize; ; size *= 2 {
    12  		buffer := make([]byte, size)
    13  		if n := runtime.Stack(buffer, all); n < size {
    14  			return buffer[:n]
    15  		}
    16  	}
    17  }
    18  

View as plain text