PRB: FreeResource Required for Locked Resources on Macintosh (199517)
The information in this article applies to:
- Microsoft Visual C++, Macintosh Cross-Development Addon 2.0
- Microsoft Visual C++, Macintosh Cross-Development Addon 4.0
- Microsoft Visual C++, Macintosh Cross-Development Addon 4.0b
This article was previously published under Q199517 SYMPTOMS
Not calling FreeResource may cause Macintosh applications to leak memory.
CAUSE
Resources on the Macintosh are fairly similar to Windows resources, but there are a few differences.
In Win32 applications, resources do not have to be locked or freed. On Macintosh platforms, however, calling LockResource does actually lock a memory block in the heap. Not calling FreeResource causes that block to remain locked.
RESOLUTION
To avoid memory leaks and heap fragmentation, FreeResource must be used on the Macintosh when a resource loaded using LoadResource is no longer needed.
REFERENCES
Macintosh Porting Guide: Resource Differences
Modification Type: | Major | Last Reviewed: | 10/24/2003 |
---|
Keywords: | kbNoUpdate kbprb KB199517 |
---|
|