diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2023-01-31 19:52:40 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2023-03-14 17:11:25 +0300 |
commit | 5407f80539c153607b114db221286199c13bc0f2 (patch) | |
tree | 1308e36d9027acb1b075cc932725cb401d5b1a80 | |
parent | bf57b5678f871c1263608a53fabb0dccc4fd6c94 (diff) | |
download | bdwgc-5407f80539c153607b114db221286199c13bc0f2.tar.gz |
Do not mix debug and non-debug allocations in disclaim tests
(a cherry-pick of commit d2b01b2d0 from 'release-8_0')
* include/gc_disclaim.h (GC_finalized_malloc): Add comment that the
debugging version of the function is missing.
* tests/disclaim_bench.c (testobj_new, main): Use GC_malloc() instead
of GC_MALLOC().
* tests/disclaim_bench.c (testobj_new): Use
GC_register_finalizer_no_order() instead of
GC_REGISTER_FINALIZER_NO_ORDER().
-rw-r--r-- | include/gc_disclaim.h | 1 | ||||
-rw-r--r-- | tests/disclaim_bench.c | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/include/gc_disclaim.h b/include/gc_disclaim.h index 27b6489e..56c26fa6 100644 --- a/include/gc_disclaim.h +++ b/include/gc_disclaim.h @@ -59,6 +59,7 @@ struct GC_finalizer_closure { /* slightly bigger than the specified allocation size, and that GC_base */ /* result points to a word prior to the start of the allocated object. */ /* The disclaim procedure is not invoked in the leak-finding mode. */ +/* There is no debugging version of this allocation API. */ GC_API GC_ATTR_MALLOC GC_ATTR_ALLOC_SIZE(1) void * GC_CALL GC_finalized_malloc(size_t /*size*/, const struct GC_finalizer_closure * /*fc*/); diff --git a/tests/disclaim_bench.c b/tests/disclaim_bench.c index df10f986..5374f080 100644 --- a/tests/disclaim_bench.c +++ b/tests/disclaim_bench.c @@ -57,16 +57,16 @@ testobj_t testobj_new(int model) testobj_t obj; switch (model) { case 0: - obj = GC_MALLOC(sizeof(struct testobj_s)); + obj = GC_malloc(sizeof(struct testobj_s)); if (obj != NULL) - GC_REGISTER_FINALIZER_NO_ORDER(obj, testobj_finalize, + GC_register_finalizer_no_order(obj, testobj_finalize, &free_count, NULL, NULL); break; case 1: obj = GC_finalized_malloc(sizeof(struct testobj_s), &fclos); break; case 2: - obj = GC_MALLOC(sizeof(struct testobj_s)); + obj = GC_malloc(sizeof(struct testobj_s)); break; default: exit(-1); @@ -115,7 +115,7 @@ int main(int argc, char **argv) model_max = 2; } - keep_arr = GC_MALLOC(sizeof(void *) * KEEP_CNT); + keep_arr = GC_malloc(sizeof(void *) * KEEP_CNT); if (NULL == keep_arr) { fprintf(stderr, "Out of memory!\n"); exit(3); |