Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@casperisfine
Copy link

And FFI::StructLayout::Field

Ref: #991

Write barrier protected objects are allowed to be promoted to the old generation, which means they only get marked on major GC.

The downside is that the RB_BJ_WRITE macro MUST be used to set references, otherwise the referenced object may be garbaged collected.

This commit also implement a dsize function so that these instance report a more relevant size in various memory profilers.

I had to get rid of the memset(0) in struct_layout_mark has with Write Barriers it's not guaranteed that the layout will be marked before fieldName is moved.

I don't think it was a good fix anyway, it's better to mark these VALUE so the GC pin them. I think we could go back to an st_table and mark only the keys with rb_mark_set. But I didn't want to go down this rabbit hole.

And FFI::StructLayout::Field

Write barrier protected objects are allowed to be promoted to the old generation,
which means they only get marked on major GC.

The downside is that the RB_BJ_WRITE macro MUST be used to set references,
otherwise the referenced object may be garbaged collected.

This commit also implement a `dsize` function so that these instance
report a more relevant size in various memory profilers.

I had to get rid of the `memset(0)` in `struct_layout_mark` has with Write Barriers
it's not guaranteed that the layout will be marked before `fieldName` is moved.

I don't think it was a good fix anyway, it's better to mark these VALUE so the GC pin
them. I think we could go back to an `st_table` and mark only the keys with `rb_mark_set`.
But I didn't want to go down this rabbit hole.
@larskanis larskanis merged commit 46ac2dc into ffi:master Mar 6, 2023
@casperisfine casperisfine mentioned this pull request Apr 3, 2023
40 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants