Implement Write Barrier and dsize for FFI::Pointer#1010
Merged
Conversation
casperisfine
force-pushed
the
pointer-write-barrier
branch
2 times, most recently
from
March 6, 2023 17:30
3959a43 to
7bbb50c
Compare
As well as FFI::MemoryPointer and FFI::AbstractMemory 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.
casperisfine
force-pushed
the
pointer-write-barrier
branch
from
March 6, 2023 17:43
7bbb50c to
eebf524
Compare
Author
|
I added FFI::Buffer as well, as it's mostly the same code. |
larskanis
added a commit
to larskanis/ffi
that referenced
this pull request
Mar 6, 2023
This disables AbstractMemory.new, which has no practical use. As discussed in ffi#1010
Member
|
Probably no. I couldn't find any use of |
40 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ref: #991
As well as FFI::MemoryPointer and FFI::AbstractMemory
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.
@larskanis I'm curious whether
FFI::AbstractMemory.newis ever meant to be used? If I make it raise no test fail, and I really don't see what the usage would be.I'm tempted to just undefine the allocation function.