summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLars Kanis <lars@greiz-reinsdorf.de>2020-08-06 22:37:01 +0200
committerAaron Patterson <aaron.patterson@gmail.com>2020-08-25 10:50:51 -0700
commit92b2d5816ae04375cef7e3909bf69954e1833160 (patch)
tree307a97de258181d13521d96f1353f706b785571b /doc
parent326d89b7cee05b33e6f73fb293a4ae9d5af6f7f2 (diff)
Add documentation to "dcompact" callback and "parent" member
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3396
Diffstat (limited to 'doc')
-rw-r--r--doc/extension.rdoc13
1 files changed, 11 insertions, 2 deletions
diff --git a/doc/extension.rdoc b/doc/extension.rdoc
index e55de34355..4aed2b3c6a 100644
--- a/doc/extension.rdoc
+++ b/doc/extension.rdoc
@@ -676,7 +676,8 @@ member of the struct.
void (*dmark)(void*);
void (*dfree)(void*);
size_t (*dsize)(const void *);
- void *reserved[2];
+ void (*dcompact)(void*);
+ void *reserved[1];
} function;
const rb_data_type_t *parent;
void *data;
@@ -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
+derived objects.
You can fill "data" with an arbitrary value for your use.
Ruby does nothing with the member.