github.com/MetalBlockchain/metalgo@v1.11.9/database/common.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package database 5 6 const ( 7 // If, when a batch is reset, the cap(batch)/len(batch) > MaxExcessCapacityFactor, 8 // the underlying array's capacity will be reduced by a factor of capacityReductionFactor. 9 // Higher value for MaxExcessCapacityFactor --> less aggressive array downsizing --> less memory allocations 10 // but more unnecessary data in the underlying array that can't be garbage collected. 11 // Higher value for CapacityReductionFactor --> more aggressive array downsizing --> more memory allocations 12 // but less unnecessary data in the underlying array that can't be garbage collected. 13 MaxExcessCapacityFactor = 4 14 CapacityReductionFactor = 2 15 )