From 364839586c6036e02fca2741a2935695b9fff7bf Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 20 May 2023 19:07:36 +0800 Subject: [PATCH] ... --- src/dict.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dict.h b/src/dict.h index 645ef9c0..6de9225e 100644 --- a/src/dict.h +++ b/src/dict.h @@ -104,6 +104,7 @@ struct Dict{ _probe(key, ok, i); if(!ok) return; _items[i].first = nullptr; + _items[i].second = nullptr; _size--; } @@ -129,6 +130,14 @@ struct Dict{ } ~Dict(){ if(_items!=nullptr) pool128.dealloc(_items); } + + void _gc_mark() const{ + for(int i=0; i<_capacity; i++){ + if(_items[i].first == nullptr) continue; + OBJ_MARK(_items[i].first); + OBJ_MARK(_items[i].second); + } + } }; } // namespace pkpy \ No newline at end of file