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.
Claims5
A computer-readable medium having computer-executable instructions for performing the steps comprising:
- executing code corresponding to at least one program;
- storing objects on a memory heap during execution of the code;
- storing references to the objects in a process stack during execution of the code;
- declaring at least one reference as pinned and storing the at least one pinned reference on the process stack;
- invoking a garbage collection algorithm;
- scanning the stack to identify the object references and the at least one pinned reference in response to invocation of the garbage collection algorithm;
- tracing the heap for inaccessible objects corresponding to the object references and the at least one pinned reference;
- removing objects that have been determined to be inaccessible;
- and
- relocating objects in the heap except for objects referenced by the at least one pinned reference.
Dependencies are inferred from the claim text.