Application Development Using Visual Basic® and .NET
by Robert J. Oberg, Peter Thorsteinson, Dana L. Wyatt
GDI+ Memory Management
An important benefit in programming with the .NET Framework is memory management facilities provided by the Common Language Runtime, including automatic garbage collection. Normally, you do not have to be concerned with explicitly freeing memory, like you do in some languages, such as C++. There is an important exception to this simplification, however. Whenever you create an object that allocates unmanaged memory, there is the potential for running out of resources that will not be taken care of by the system garbage collector.
Objects in GDI+ provide an example of resources with unmanaged memory. Device contexts, as encapsulated by Graphics objects, pens, brushes, and fonts, all encapsulate GDI resources, which are not ...
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