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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
add logging for memory allocation
chrislue71dcfb3a6dc
diff --git a/weed/util/mem/slot_pool.go b/weed/util/mem/slot_pool.goindex e6680d3cba..d5a55f23f6 100644--- a/weed/util/mem/slot_pool.go+++ b/weed/util/mem/slot_pool.go@@ -1,6 +1,10 @@package mem-import "sync"+import (+ "github.com/chrislusf/seaweedfs/weed/glog"+ "sync"+ "sync/atomic"+)var pools []*sync.Pool@@ -34,11 +38,17 @@ func getSlotPool(size int) *sync.Pool {return pools[index]}+var total int64+func Allocate(size int) []byte {+ newVal := atomic.AddInt64(&total, 1)+ glog.V(4).Infof("++> %d", newVal)slab := *getSlotPool(size).Get().(*[]byte)return slab[:size]}func Free(buf []byte) {+ newVal := atomic.AddInt64(&total, -1)+ glog.V(4).Infof("--> %d", newVal)getSlotPool(cap(buf)).Put(&buf)}