summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-08-05 20:01:56 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-08-05 20:01:56 +0300
commit952c70947375c8539028b3958e7a5d9ce4b49707 (patch)
tree1bc8f0faf7f800674aa44b81cdb688dfe8eba3ef /include
parent12c142f2b0b6675420eafcbcf9b53db0d9617d19 (diff)
downloadbdwgc-952c70947375c8539028b3958e7a5d9ce4b49707.tar.gz
New GC_iterate_free_hblks API function
Issue #460 (bdwgc). * allchblk.c (GC_iterate_free_hblks): Implement (copy part of code from GC_compute_large_free_bytes). * allchblk.c [!NO_DEBUGGING || GC_ASSERTIONS] (add_hb_sz): New static function. * allchblk.c [!NO_DEBUGGING || GC_ASSERTIONS] (GC_compute_large_free_bytes): Use GC_iterate_free_hblks(add_hb_sz). * include/gc/gc_mark.h (GC_iterate_free_hblks): Declare public function.
Diffstat (limited to 'include')
-rw-r--r--include/gc/gc_mark.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/gc/gc_mark.h b/include/gc/gc_mark.h
index f825cac0..88557147 100644
--- a/include/gc/gc_mark.h
+++ b/include/gc/gc_mark.h
@@ -184,6 +184,12 @@ GC_API GC_ATTR_CONST size_t GC_CALL GC_get_hblk_size(void);
typedef void (GC_CALLBACK *GC_walk_hblk_fn)(struct GC_hblk_s *,
GC_word /* client_data */);
+/* Apply fn to each completely empty heap block. It is the */
+/* responsibility of the caller to avoid data race during the function */
+/* execution (e.g. by holding the allocation lock). */
+GC_API void GC_CALL GC_iterate_free_hblks(GC_walk_hblk_fn,
+ GC_word /* client_data */) GC_ATTR_NONNULL(1);
+
/* Apply fn to each allocated heap block. It is the responsibility */
/* of the caller to avoid data race during the function execution (e.g. */
/* by holding the allocation lock). */