diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-01-14 10:51:06 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-01-14 10:51:06 +0300 |
commit | ffe92c3e77cc29f543f6a54a6213c7f9191571f9 (patch) | |
tree | ae99901a0bd2b10f9dc36e4f6da4e8bc1b19c587 /allchblk.c | |
parent | 0a58ccfa02b5b51a91f4d9797ef6932a3fba8cf9 (diff) | |
download | bdwgc-ffe92c3e77cc29f543f6a54a6213c7f9191571f9.tar.gz |
Fix last_reclaimed..gc_no interval comparison to threshold in unmap_old
(fix commit 14c324f8b)
* allchblk.c [USE_MUNMAP] (GC_unmap_old): Replace
(unsigned short)GC_gc_no-hb_last_reclaimed to
(unsigned short)(GC_gc_no-hb_last_reclaimed) to handle
value wrapping in hb_last_reclaimed (and the truncated GC_gc_no)
correctly.
Diffstat (limited to 'allchblk.c')
-rw-r--r-- | allchblk.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -409,7 +409,9 @@ GC_INNER void GC_unmap_old(void) hhdr = HDR(h); if (!IS_MAPPED(hhdr)) continue; - if ((unsigned short)GC_gc_no - hhdr -> hb_last_reclaimed > + /* Check that the interval is larger than the threshold (the */ + /* truncated counter value wrapping is handled correctly). */ + if ((unsigned short)(GC_gc_no - hhdr->hb_last_reclaimed) > (unsigned short)GC_unmap_threshold) { GC_unmap((ptr_t)h, hhdr -> hb_sz); hhdr -> hb_flags |= WAS_UNMAPPED; |