ADC Home > Reference Library > Technical Q&As > Legacy Documents > Graphics & Imaging >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

QuickDraw GX and Color Profiles


Q: Do I need to call GXCloneColorProfile before calling GXConvertColor? Since the color passed into GXConvertColor by ColorSync is destroyed, should the color profile passed in as part of the color be disposed? If not, isn't that a memory leak?

A: Calling GXCloneColorProfile is not necessary, and it would require additional work that does not need to be done. gxColor is a public data structure, not an object. The application, not GX, handles adding/maintaining references to objects with respect to gxColor's (and gxBitmaps). GX maintains owner counts when the profile is attached to another GX object (using GXNewBitmap, GXSetInkColor, etc.). This is not a memory leak.

For example, consider this scenario:

When an application gets a shape's color, the ink's profile has two owners -- the shape and the application. Therefore, the application can reference the profile in gxColor structures, even if the shape is disposed. Once the application calls GXDisposeColorProfile, the reference is no longer valid. Cloning the color profile does nothing except to require that GXDisposeColorProfile be called afterward. As a result, all that happens is that time is wasted as the owner count goes from a positive number to that number plus 1, and then back down.

[May 01 1995]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.