Skip to content

Commit

Permalink
fix(core): fix visited uids bitset memory
Browse files Browse the repository at this point in the history
  • Loading branch information
harshil-goel committed Nov 16, 2024
1 parent 27450c1 commit bacda28
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tok/hnsw/persistent_hnsw.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type persistentHNSW[T c.Float] struct {
// nodeAllEdges[65443][1][3] indicates the 3rd neighbor in the first
// layer for uuid 65443. The result will be a neighboring uuid.
nodeAllEdges map[uint64][][]uint64
visitedUids bitset.BitSet
visitedUids *bitset.BitSet
deadNodes map[uint64]struct{}
}

Expand Down Expand Up @@ -366,7 +366,7 @@ func (ph *persistentHNSW[T]) SearchWithPath(
start := time.Now().UnixMilli()
r = index.NewSearchPathResult()

ph.visitedUids.ClearAll()
ph.visitedUids = bitset.New(10)

// 0-profile_vector_entry
var startVec []T
Expand Down Expand Up @@ -451,7 +451,7 @@ func (ph *persistentHNSW[T]) insertHelper(ctx context.Context, tc *TxnCache,
inLevel := getInsertLayer(ph.maxLevels) // calculate layer to insert node at (randomized every time)
var layerErr error

ph.visitedUids.ClearAll()
ph.visitedUids = bitset.New(10)

for level := 0; level < inLevel; level++ {
// perform insertion for layers [level, max_level) only, when level < inLevel just find better start
Expand Down

0 comments on commit bacda28

Please sign in to comment.