Patent ID: 7484067

Claim:
A method for ensuring non-interfering garbage collection in a real time multi-threaded environment, comprising: associating an incarnation counter with a scoped memory area, wherein the incarnation counter is atomically updated upon access by a no heap thread not interruptible by garbage collection operations; identifying a write stub comprising instructions to store data into storage locations of the scoped memory area, wherein the instructions are dynamically modified to interrupt execution of a garbage collection thread; and executing a garbage collection thread over the scoped memory area, comprising at least one of: attempting a read from the scoped memory area, comprising: reading an incarnation number from the incarnation counter of the scoped memory area and locally storing the incarnation number; loading a value from a storage location in the scoped memory area and rereading the incarnation number; and comparing the reread incarnation number with the locally stored incarnation number and interrupting the garbage collection thread when the reread and locally stored incarnation numbers fail to match; and attempting a write to the scoped memory area, comprising executing the instructions in the write stub, comprising one of storing data into a location in the scoped memory area and interrupting execution of the garbage collection thread.