Article ID: 199540
Article Last Modified on 10/16/2002
APPLIES TO
- Microsoft Visual C++ 4.0 Cross Development Edition for Macintosh
This article was previously published under Q199540
SYMPTOMS
When selecting a bitmap into a device context, SelectObject may return NULL.
CAUSE
When 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:
- Set the bitmaps as read-only using SetBitmapReadOnly(hBitmap, BRO_READONLY) before selecting them into the DC.
- Reuse the same bitmap object.
- Develop using Visual C++ for Macintosh 4.0.
- Call the undocumented internal function _FreeGWorldCache().
- Increase memory requirements.
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
REFERENCES
(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Adam Kim, Microsoft Corporation.
Additional query words: DeleteObject Bitmap SelectObject leak CreateBitmap CreateBitmapIndirect
Keywords: kbbug kbgraphic KB199540