BUG: MAPILogonEx Memory Leak

ID: Q215463


The information in this article applies to:


SYMPTOMS

The applications that repetitively log on to MAPI or Collaboration Data Objects (CDO) to process very large message volumes can exhibit problems after running normally for long periods of time. The following problems might be seen:


CAUSE

A memory heap created at the start of a MAPI session is not destroyed when the session is released.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

Steps to Reproduce Behavior

To reproduce the behavior, place MAPILogonEx in a loop construct and run the program so that the loop runs at least 6000 times, for example:

while (1)
{
  LPMAPISESSION  lpSession;
  HRESULT hr;
  int x;
  hr = MAPILogonEx(0, szLogonProfile, NULL, MAPI_NEW_SESSION |
MAPI_LOGON_UI | MAPI_NO_MAIL|MAPI_USE_DEFAULT, &lpSession);
  if (hr !=  S_OK)
  {
   printf ("ERROR %x",hr);
   break;
  };

  x++;
  printf("LOGON %d\n",x);

  hr = lpSession -> Logoff (NULL,NULL,0);
  if (hr !=  S_OK)
  {
    printf ("ERROR at Logoff %x",hr);
    break;
  };

  hr = lpSession ->Release();  
  if (hr !=  S_OK)
  {
   printf ("ERROR at Release %x",hr);
   break;
  };
} 

Additional query words: kbMAPI100bug kbMsg kbGrpMsg kbCDO kbCDO121


Keywords          : kbCDO kbCDO121 kbMsg kbMAPI100bug kbGrpMsg 
Version           : WINDOWS:1.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 19, 1999