Garbage Collection and Threading

Garbage collection can occur at any time. In order to perform its job, all threads are suspended. If any managed threads are currently executing unmanaged code, these threads are resumed. However, before resuming these threads, the CLR inserts code to suspend the thread when it returns to managed code. These threads are allowed to resume because memory is pinned (locked down) when it is referenced by unmanaged code.

Get Delphi for .NET Developer’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.