reuse fragment memory

This commit is contained in:
Todd Gruben 2017-09-06 14:41:14 -05:00
parent ba0114ad1e
commit a8b070716d
2 changed files with 6 additions and 4 deletions

View file

@ -312,7 +312,8 @@ func (f *Fragment) close() error {
func (f *Fragment) closeStorage() error {
// Clear the storage bitmap so it doesn't access the closed mmap.
f.storage = roaring.NewBitmap()
//f.storage = roaring.NewBitmap()
// Unmap the file.
if f.storageData != nil {

View file

@ -617,9 +617,10 @@ func (b *Bitmap) UnmarshalBinary(data []byte) error {
// Read key count in bytes sizeof(cookie):(sizeof(cookie)+sizeof(uint32)).
keyN := binary.LittleEndian.Uint32(data[4:8])
b.keys = make([]uint64, keyN)
b.containers = make([]*container, keyN)
if int(keyN) != len(b.keys) {
b.keys = make([]uint64, keyN)
b.containers = make([]*container, keyN)
}
headerSize := headerBaseSize
// Descriptive header section: Read container keys and cardinalities.