-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-GC-coreclr
Milestone
Description
GC.IsPinnedHeapObject(object obj)
Returns true if the obj is allocated on pinned object heap.
Caveat: we generally cannot know cheaply/precisely if object is pinned (thus this is not a IsPinnedObject), but we can tell if it resides in Pinned Object Heap.
===
There are obvious scenarios where this could be useful.
When trying to use pinned object heap in prototypes, it does not take long before you want to write code like:
if (GC.IsPinnedHeapObject(obj))
{
.. something simple that relies on obj not relocating ..
}
else
{
.. pinning by hand for compat or throw something, if this is unexpected...
}or do something like:
Debug.Assert(GC.IsPinnedHeapObject(buffer), "buffer must be on pinned heap");Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-GC-coreclr