|author||Lars Kanis <firstname.lastname@example.org>||2020-08-06 22:37:01 +0200|
|committer||Aaron Patterson <email@example.com>||2020-08-25 10:50:51 -0700|
Add documentation to "dcompact" callback and "parent" member
Notes: Merged: https://github.com/ruby/ruby/pull/3396
1 files changed, 11 insertions, 2 deletions
diff --git a/doc/extension.rdoc b/doc/extension.rdoc
index e55de343559..4aed2b3c6a6 100644
@@ -676,7 +676,8 @@ member of the struct.
size_t (*dsize)(const void *);
- void *reserved;
+ void (*dcompact)(void*);
+ void *reserved;
const rb_data_type_t *parent;
@@ -708,7 +709,15 @@ Its parameter is a pointer to your struct.
You can pass 0 as dsize if it is hard to implement such a function.
But it is still recommended to avoid 0.
-You have to fill reserved and parent with 0.
+dcompact is invoked when memory compaction took place.
+Referred Ruby objects that were marked by rb_gc_mark_movable()
+can here be updated per rb_gc_location().
+You have to fill reserved with 0.
+parent can point to another C type definition that the Ruby object
+is inherited from. Then TypedData_Get_Struct() does also accept
You can fill "data" with an arbitrary value for your use.
Ruby does nothing with the member.