just rely on escape analysis
This commit is contained in:
parent
c42cdcbaa6
commit
843730e11b
1 changed files with 2 additions and 3 deletions
|
|
@ -157,11 +157,10 @@ func Nil() Allocator {
|
||||||
|
|
||||||
// Temporary wraps an Allocator, restoring it to its previous state when Reset is called.
|
// Temporary wraps an Allocator, restoring it to its previous state when Reset is called.
|
||||||
func Temporary(alloc Allocator) Allocator {
|
func Temporary(alloc Allocator) Allocator {
|
||||||
watermark := new(uintptr)
|
watermark := Save(alloc)
|
||||||
*watermark = Save(alloc)
|
|
||||||
return func(a Action, size, align uintptr, wm *uintptr) (unsafe.Pointer, error) {
|
return func(a Action, size, align uintptr, wm *uintptr) (unsafe.Pointer, error) {
|
||||||
if a == ActionReset {
|
if a == ActionReset {
|
||||||
Restore(alloc, *watermark)
|
Restore(alloc, watermark)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue