Skip to content

Store static fields with [FixedAddressValueType] in the Pinned Object Heap. #66043

@teo-tsirpanis

Description

@teo-tsirpanis

The assembly unloadability document says that static fields with [FixedAddressValueType] are incompatible with unloadability because the pin is implemented using a strong pinned handle. However, since the .NET Core 3.0 era when unloadability was introduced, the runtime has some additional gadgets up its sleeves, like the Pinned Object Heap.

The problem of unloadability with these fields could be solved by just placing them in the POH. It might also be a good idea to implement [FixedAddressValueType] this way always, to lessen the pressure of stray pinned objects in the generational heap.

I am not personally affected by this issue and I don't ask to treat it with urgency. I just got a random idea and wanted to gather some feedback. It might be decided that this attribute is so rare that working on it is not worth the effort at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions