Declarative pinning
AssigneeMicrosoft Corporation
InventorsPatrick H. Dussud, Vance P. Morrison
Life of this patent
Estimating the term…
Abstract
A system and method is provided for efficiently pinning references to the managed heap. The system and method allow for references to managed objects to be declared as pinned during a call to unmanaged code. The references are then reported as pinned to a garbage collector in response to invocation of a garbage collection service. The reference can be declared as pinned by a programmer within the source code or automatically invoked at run-time based on an unsafe condition. The garbage collection service will not move or relocate objects that are referenced by the active pinned local variables. If a garbage collection does not occur, the fact that the local variables are declared pinned is ignored.
Claims20
A system for managing memory, comprising:
- a component that identifies unsafe system condition(s), an unsafe condition includes at least one of a call to unmanaged code that manipulates managed data or a condition as determined by predefined criteria that will result in a failure;
- and
- a declaration component that declares at least one reference as pinned based on the unsafe condition, so that objects associated with the at least one pinned reference are not relocated during memory reclamation and objects associated with no pinned references can be relocated during memory reclamation.
A method for managing memory, the method comprising:
- determining an unsecured system condition;
- and
- declaring at least one reference as pinned during the unsecured condition, so that objects related to the at least one pinned reference are not moved during memory reclamation and objects related to non-pinned references can be moved during memory reclamation.
Dependencies are inferred from the claim text.