O'Reilly logo

Delphi for .NET Developer’s Guide by Xavier Pacheco

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How Garbage Collection Works

Two types of resources must be managed with which you should be familiar. These are managed resources and unmanaged resources. Managed resources are those about which the CLR knows how to manage because they are defined within the type specifications of the CLR. Unmanaged resources are those that the CLR will not know how to manage. Examples of such resources are those that require a Handle, such as a file or Windows resource (bitmap, icon, mutex, and so on).

The GC follows a simple mechanism for freeing heap memory of objects that are no longer being used within the application. Consider Figure 9.1.

Figure 9.1. Objects in the heap.

This figure represents the heap containing some objects allocated from an application. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required