Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

446 B
Raw Blame
package operation

import (
	"sync/atomic"

	"github.com/valyala/bytebufferpool"
)

var bufferCounter int64

func GetBuffer() *bytebufferpool.ByteBuffer {
	defer func() {
		atomic.AddInt64(&bufferCounter, 1)
		// println("+", bufferCounter)
	}()
	return bytebufferpool.Get()
}

func PutBuffer(buf *bytebufferpool.ByteBuffer) {
	defer func() {
		atomic.AddInt64(&bufferCounter, -1)
		// println("-", bufferCounter)
	}()
	bytebufferpool.Put(buf)
}