Ruby 3.5.0dev (2025-09-18 revision 176b3b514d8f4bcea38a10f0567b760701e46058)
Data Fields
RData Struct Reference

#include <rdata.h>

Data Fields

struct RBasic basic
 Basic part, including flags and class.
 
RUBY_DATA_FUNC dmark
 This function is called when the object is experiencing GC marks.
 
RUBY_DATA_FUNC dfree
 This function is called when the object is no longer used.
 
void * data
 Pointer to the actual C level struct that you want to wrap.
 

Detailed Description

Deprecated:

Old "untyped" user data. It has roughly the same usage as struct RTypedData, but lacked several features such as support for compaction GC. Use of this struct is not recommended any longer. If it is dead necessary, please inform the core devs about your usage.

Definition at line 120 of file rdata.h.

Field Documentation

◆ basic

struct RBasic RData::basic

Basic part, including flags and class.

Definition at line 123 of file rdata.h.

◆ data

void* RData::data

Pointer to the actual C level struct that you want to wrap.

This is after dmark and dfree to allow DATA_PTR to continue to work for both RData and non-embedded RTypedData.

Definition at line 149 of file rdata.h.

Referenced by rb_data_object_wrap().

◆ dfree

RUBY_DATA_FUNC RData::dfree

This function is called when the object is no longer used.

You need to do whatever necessary to avoid memory leaks.

Warning
This is called during GC runs. Object allocations are impossible at that moment (that is why GC runs).

Definition at line 143 of file rdata.h.

Referenced by rb_data_object_wrap(), and rb_data_object_zalloc().

◆ dmark

RUBY_DATA_FUNC RData::dmark

This function is called when the object is experiencing GC marks.

If it contains references to other Ruby objects, you need to mark them also. Otherwise GC will smash your data.

See also
rb_gc_mark()
Warning
This is called during GC runs. Object allocations are impossible at that moment (that is why GC runs).

Definition at line 134 of file rdata.h.

Referenced by rb_data_object_wrap(), and rb_data_object_zalloc().


The documentation for this struct was generated from the following file: