Skip to content

Commit 8a9d241

Browse files
Merge pull request #28 from sthaha/fix-callers-mem-alloc
Reduce memory allocation in callers
2 parents 61c3167 + d8ece3b commit 8a9d241

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

stack.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ func callers(depth int) *stack {
5959
var pcs [maxDepth]uintptr
6060

6161
n := runtime.Callers(2+depth, pcs[:])
62-
63-
var st stack = pcs[0:n]
62+
st := make(stack, n)
63+
copy(st, pcs[:n])
6464

6565
return &st
6666
}

0 commit comments

Comments
 (0)