sanity check ReleaseMemory as well

This commit is contained in:
vyzo 2021-12-22 12:59:01 +02:00
parent 56da0ac34f
commit 61d2f1c8ce

View File

@ -57,6 +57,11 @@ func (rc *ResourceScope) ReleaseMemory(size int) {
defer rc.Unlock()
rc.memory -= int64(size)
// sanity check for bugs upstream
if rc.memory < 0 {
panic("BUG: too much memory released")
}
}
func (rc *ResourceScope) GetBuffer(size int) ([]byte, error) {