diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-07-05 17:38:11 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-07-05 17:38:11 +0300 |
commit | 0dfe3cc3b4fd7428aeb94966df6496659ae52f16 (patch) | |
tree | 3d647a0c2d28bb0f35acb5666560a721922f65b7 /dbg_mlc.c | |
parent | 74c113b720f6201f15aa320b65feeacad71ca7a5 (diff) | |
download | bdwgc-0dfe3cc3b4fd7428aeb94966df6496659ae52f16.tar.gz |
Fix test_cpp failure in case GC_DEBUG is defined
Now GC_bytes_freed is updated even if the real deallocation of the
explicitly freed object is deferred.
* dbg_mlc.c (GC_debug_free): Increment GC_bytes_freed by hhdr->hb_sz
in case of GC_free is not called (when the object is filled with
GC_FREED_MEM_MARKER); add comment.
Diffstat (limited to 'dbg_mlc.c')
-rw-r--r-- | dbg_mlc.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -799,11 +799,17 @@ GC_API void GC_CALL GC_debug_free(void * p) GC_free(base); } else { word i; - word obj_sz = BYTES_TO_WORDS(hhdr->hb_sz - sizeof(oh)); + word sz = hhdr -> hb_sz; + word obj_sz = BYTES_TO_WORDS(sz - sizeof(oh)); for (i = 0; i < obj_sz; ++i) ((word *)p)[i] = GC_FREED_MEM_MARKER; - GC_ASSERT((word *)p + i == (word *)(base + hhdr -> hb_sz)); + GC_ASSERT((word *)p + i == (word *)(base + sz)); + /* Update the counter even though the real deallocation */ + /* is deferred. */ + LOCK(); + GC_bytes_freed += sz; + UNLOCK(); } } /* !GC_find_leak */ } |