diff --git a/scope.go b/scope.go index 57fc33b..f815501 100644 --- a/scope.go +++ b/scope.go @@ -78,7 +78,7 @@ func NewTxnResourceScope(owner *ResourceScope) *ResourceScope { // Resources implementation func (rc *Resources) checkMemory(rsvp int64) error { // overflow check; this also has the side effect that we cannot reserve negative memory. - newmem := rc.memory + int64(rsvp) + newmem := rc.memory + rsvp if newmem < rc.memory { return fmt.Errorf("memory reservation overflow: %w", ErrResourceLimitExceeded) } @@ -103,7 +103,7 @@ func (rc *Resources) reserveMemory(size int64) error { return err } - rc.memory += int64(size) + rc.memory += size return nil }