Chapter 18. Unsafe Code
Unsafe code can access unmanaged memory, which is outside the realm of the Common Language Runtime (CLR). Conversely, safe code is limited to accessing the managed heap. The managed heap is managed by the Garbage Collector, which is a component of the CLR. Code restricted to the managed heap is intrinsically safer than code that accesses unmanaged memory. The CLR automatically releases unused objects, performs type verification, and conducts other checks on managed memory. This is not done automatically for unmanaged memory; rather, the developer is responsible for these tasks. With managed code, developers can focus on core application development instead of administrative tasks such as memory management. For this reason, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access