GCHandle.Alloc(x, GCHandleType.Pinned) calls should be replaced by fixed statements with IntPtr casts where appropriate #22620
Unanswered
Mrnikbobjeff
asked this question in
Ideas
Replies: 1 comment 1 reply
-
After further sighting of the code I believe this would also reduce risks due to automatic unpinning in exception cases due to the finally lowering |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
GCHandle.Alloc for pinned statements is strictly worse than using a fixed statement with a T* cast. The roslyn lowering does not incur the same penalty as the GCHandle. I was told to ping @jonathanpeppers for the performance topic
Beta Was this translation helpful? Give feedback.
All reactions