ruby-changes:62702
From: Lars <ko1@a...>
Date: Wed, 26 Aug 2020 02:51:09 +0900 (JST)
Subject: [ruby-changes:62702] 92b2d5816a (master): Add documentation to "dcompact" callback and "parent" member
https://git.ruby-lang.org/ruby.git/commit/?id=92b2d5816a From 92b2d5816ae04375cef7e3909bf69954e1833160 Mon Sep 17 00:00:00 2001 From: Lars Kanis <lars@g...> Date: Thu, 6 Aug 2020 22:37:01 +0200 Subject: Add documentation to "dcompact" callback and "parent" member diff --git a/doc/extension.rdoc b/doc/extension.rdoc index e55de34..4aed2b3 100644 --- a/doc/extension.rdoc +++ b/doc/extension.rdoc @@ -676,7 +676,8 @@ member of the struct. https://github.com/ruby/ruby/blob/trunk/doc/extension.rdoc#L676 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. https://github.com/ruby/ruby/blob/trunk/doc/extension.rdoc#L709 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. -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/