]> granicus.if.org Git - gc/commitdiff
Fix marks and hb_n_marks consistency when disclaim returns true
authorPetter A. Urkedal <paurkedal@gmail.com>
Tue, 30 Oct 2018 20:00:32 +0000 (21:00 +0100)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 23 Nov 2018 22:11:32 +0000 (01:11 +0300)
* reclaim.c [ENABLE_DISCLAIM] (GC_disclaim_and_reclaim): When a
disclaim callback returns 1 to protect an object from being reclaimed,
mark it to skip it on repeated scans within the cycle. In particular,
this fixes sz*hhdr->hb_n_marks<=HBLKSIZE assertion failure due to
excessive increments of hb_n_marks.

reclaim.c

index f729f5d571603a62e6e245ec9deafa6f53c20271..ac92e05873393a7e46bab99c727eb3763ddea353 100644 (file)
--- a/reclaim.c
+++ b/reclaim.c
@@ -238,6 +238,7 @@ STATIC ptr_t GC_reclaim_uninit(struct hblk *hbp, hdr *hhdr, word sz,
     while ((word)p <= (word)plim) {
         int marked = mark_bit_from_hdr(hhdr, bit_no);
         if (!marked && (*disclaim)(p)) {
+            set_mark_bit_from_hdr(hhdr, bit_no);
             hhdr -> hb_n_marks++;
             marked = 1;
         }