Patent ID: 7882158

Claim:
A system for executing code in real-time, the system comprising: a compiler that compiles source code into an intermediate definition language and then into executable code for executing one or more programs, wherein the executable code includes both managed and unmanaged code including at least one call from the managed code to the unmanaged code that will pass one or more references to one or more objects on a memory heap, and wherein the one or more references to the one or more objects are declared as pinned in the source code, the compiler, upon determining that the one or more references to the one or more objects is declared as pinned, declaring the one or more references as pinned during compiling of the source code into the intermediate definition language; a processor that executes the executable code derived from the intermediate definition language, and during execution, creates objects on the memory heap that are referenced by references on a stack of the managed code, including the one or more objects on the memory heap that are referenced by the pinned references; and a memory management system that, during a garbage collection routine that executes during the execution of the executable code, identifies any references to objects on the memory heap, and based on the references to the objects: (1) identifies all objects on the memory heap that are referenced by one or more of the references on the stack of the managed code; and (2) for each referenced object, determines whether any of the one or more references to the object is one of the one or more pinned references, such that upon determining that a referenced object is referenced by at least one of the one or more pinned references, the referenced object is not moved from its location on the memory heap to enable the unmanaged portion of the executable code to retain access to the object referenced by the at least one of the one or more pinned references.