aboutsummaryrefslogtreecommitdiff
path: root/tx.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2016-12-21 16:46:06 -0700
committerGitHub <noreply@github.com>2016-12-21 16:46:06 -0700
commitf0cf3bfd5b5fe259fea19d5d6a2f8805e9b419e2 (patch)
tree538785d63060483ca9a4e802ddd6398130a8d7b7 /tx.go
parentMerge pull request #638 from boltdb/fix-634 (diff)
parentDon't allocate huge slices to merge pgids in freelist.write (diff)
downloaddedo-f0cf3bfd5b5fe259fea19d5d6a2f8805e9b419e2.tar.gz
dedo-f0cf3bfd5b5fe259fea19d5d6a2f8805e9b419e2.tar.xz
Merge pull request #636 from josharian/perf
Don't allocate huge slices to merge pgids in freelist.write
Diffstat (limited to 'tx.go')
-rw-r--r--tx.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/tx.go b/tx.go
index 1cfb4cd..37a8ca1 100644
--- a/tx.go
+++ b/tx.go
@@ -381,7 +381,9 @@ func (tx *Tx) Check() <-chan error {
func (tx *Tx) check(ch chan error) {
// Check if any pages are double freed.
freed := make(map[pgid]bool)
- for _, id := range tx.db.freelist.all() {
+ all := make([]pgid, tx.db.freelist.lenall())
+ tx.db.freelist.copyall(all)
+ for _, id := range all {
if freed[id] {
ch <- fmt.Errorf("page %d: already freed", id)
}