http://www.metrowerks.com">
The information in this article applies to:
SYMPTOMSWhen selecting a bitmap into a device context, SelectObject may return NULL. CAUSEWhen a bitmap is deleted, the memory allocated for it is not released from the application heap space. This problem occurs only for bitmaps that are not read-only (see SetBitmapReadOnly) and only with 68K applications developed using Visual C++ for Macintosh 4.0b. RESOLUTION
Following are five different resolutions:
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. MORE INFORMATION
When a bitmap is created and selected into a device context on the Macintosh using the Windows Portability Library (WPL), a new GWorld object is created (if needed) and stored in a cache of four GWorlds. This cache is also used when deleting bitmap objects. Unfortunately the cache is filled but never automatically cleared. Additionally QuickDraw allocates memory for each GWorld, which is also not released.
Sometimes the problem can be reduced by using CreateBitmapIndirect() instead of CreateBitmap() when creating the bitmap.
As a debugging aid, the Macintosh application's heap space can be viewed using ZoneRanger, which can be obtained from Metrowerk's web site: http://www.metrowerks.com REFERENCES(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Adam Kim, Microsoft Corporation. Additional query words: DeleteObject Bitmap SelectObject leak CreateBitmap CreateBitmapIndirect
Keywords : kbgraphic kbMAC kbVC kbVC400bug kbDSupport MacPrgIss |
Last Reviewed: December 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |