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
fix memory allocation
chrislub9ae16fbc564
diff --git a/weed/util/mem/slot_pool.go b/weed/util/mem/slot_pool.goindex d5a55f23f6..5bd759ab7a 100644--- a/weed/util/mem/slot_pool.go+++ b/weed/util/mem/slot_pool.go@@ -14,7 +14,7 @@ const (func bitCount(size int) (count int) {for ; size > min_size; count++ {- size = size >> 1+ size = (size + 1) >> 1}return}diff --git a/weed/util/mem/slot_pool_test.go b/weed/util/mem/slot_pool_test.goindex 1149515222..44f9ec0045 100644--- a/weed/util/mem/slot_pool_test.go+++ b/weed/util/mem/slot_pool_test.go@@ -1,6 +1,7 @@package memimport (+ "github.com/stretchr/testify/assert""testing")@@ -25,6 +26,16 @@ func TestAllocateFree(t *testing.T) {}+func TestAllocateFreeEdgeCases(t *testing.T) {+ assert.Equal(t, 1, bitCount(2048))+ assert.Equal(t, 2, bitCount(2049))++ buf := Allocate(2048)+ Free(buf)+ buf = Allocate(2049)+ Free(buf)+}+func TestBitCount(t *testing.T) {count := bitCount(12)if count != 0 {