aboutsummaryrefslogtreecommitdiff
path: root/bucket.go
diff options
context:
space:
mode:
Diffstat (limited to 'bucket.go')
-rw-r--r--bucket.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/bucket.go b/bucket.go
index fdc9852..4d45b38 100644
--- a/bucket.go
+++ b/bucket.go
@@ -371,8 +371,9 @@ func (b *Bucket) Stats() BucketStats {
b.forEachPage(func(p *page, depth int) {
if (p.flags & leafPageFlag) != 0 {
s.KeyN += int(p.count)
- used := pageHeaderSize + (leafPageElementSize * int(p.count))
+ used := pageHeaderSize
if p.count != 0 {
+ used += leafPageElementSize * int(p.count-1)
lastElement := p.leafPageElement(p.count - 1)
used += int(lastElement.pos + lastElement.ksize + lastElement.vsize)
}