Skip to content

Is it safe to clear managed object references from unmanaged code? #51567

Answered by huoyaoyuan
acaly asked this question in Q&A
Discussion options

You must be logged in to vote

Assuming GC thread is going to do compact phase, and thus moving the reference. The moving and clearing may be in a race condition. Since pointer sizes are naturally atomic, the memory will probably not be corrupt, but it may be unreliable that GC move writes after cleaning, making the reference not really cleared.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@acaly
Comment options

@acaly
Comment options

@huoyaoyuan
Comment options

@acaly
Comment options

@acaly
Comment options

Answer selected by acaly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants