INFO: Possible Causes for Memory Leaks in MAPI Clients/Providers

ID: Q188958

The information in this article applies to:

SUMMARY

During testing and deployment of an Extended Messaging Application Programming Interface (MAPI) client or service provider, it may appear that the application is leaking memory. It is often difficult to find the exact cause of a memory leak. This article lists several possible reasons for memory leaks in MAPI client or service provider applications.

MORE INFORMATION

There are several logic errors that may cause this problem. A list of possible reasons follows. This is not a comprehensive list, but it does cover the most common problems developers have run into in their code.

Any memory allocated on your behalf by the MAPI subsystem should be released and set to NULL. This includes pointers to interfaces, structures, and any other data types that MAPI deals with. The common rule of thumb is "If MAPI gives it to you, free it or release it."

Make sure you always use the MAPIAllocateBuffer, MAPIAllocateMore and MAPIFreeBuffer functions to allocate and deallocate memory off of the heap space.

When implementing your own interfaces, be sure to follow the rules of COM as strictly as possible to guarantee minimum memory loss from your application.

Additional query words: kbMsg kbMAPI100 kbMAPI

Keywords          : kbfaq
Technology        : kbMsg kbMAPI
Version           : WINDOWS:1.0
Platform          : WINDOWS
Issue type        : kbinfo

Last Reviewed: July 7, 1998