Outlook Out Of Memory Errors

Written by Mike Rede on September 1, 2009

Have you ever received error messages about running out of memory when using Outlook?

There are many reasons for why this will happen. Most of the time, I find myself closing down applications on my screen to free up memory. Sometimes you will find that your email clients are using up system resources on the computer. You may see the following error show up repeatedly:

Task ‘private email of company – Sending and Receiving’ reported error (0x8007000E): ‘Out of memory or system resources. Close some windows or programs and try again.’

I’m going to explain a couple ways for you to avoid this issue.

Oftentimes just increasing the swap space or adding memory will solve this problem. It is not unusual in a corporate environment for <dot>  PST files to grow into the gigabytes. Large attachments saved in your end user’s files can cause this to happen. That’s why it’s important to have set limits on how much email can be stored per user.

You might want to try setting up a tiered limit system where email file storage is based on the end user’s work needs. For example, code developers often need large amounts of disk space for their programs and will sometimes use their email space to send and receive large chunks of source code. Having an email archiving system can help limit the amount of email data that accidentally is left in your users email <dot> PST files.

It is always possible that you have a virus but if you keep your system patched and current with antivirus software this should not be a problem. A good practice is to run scans on a routine basis.

And then there is the case that you are having hardware related errors which can cause out of memory errors to occur. It could be bad or failed memory that caused the error(s). 

As strange as it may sound just setting Outlook as your default mail program can also fix the problem.

There is also the scenario where you are getting a MAPI error. It will show up as “MAPI: ShowForm Causes Out-Of-Memory Error” from Outlook.

Working with forms, and especially if you are displaying multiple Outlook forms by  running the IMAPISession::PrepareForm and IMAPISession::ShowForm functions in a loop, can cause errors to happen on slower computers. Initially your ShowForm execution will work but then you will find that additional calls to ShowForm result in the following error message when you are trying to add attachments using drag and drop functionality:

“Out of memory or system resources. Close some windows and try again.”

What can happen is that there is code that is producing a bad reference count. The result is that an attempt to create an internal object will fail and return an error code. The error code gets interpreted as an out of memory condition.

Invoking the ShowForm function happens when a call is made which causes the corresponding form server to be loaded that is related to the registered form.  A reference will be added, by MAPI, to the form server when it executes the form. After the form is closed, the reference is released by MAPI. The form server will shut down after no more references are left.

You might have a form that is registered to use Outlook as its form server. Using it will get your message displayed but when you close it this will also cause Outlook to shut down. It is in this shutting down process that Outlook cannot accept calls to open a new form that leads to your Out of Memory or Resources problem. The problem is related to a timing issue. If another process attempts to invoke another form, while Outlook is in a shut down mode, then MAPI will interpret this state as a failure caused by limited memory. The trick is to allow enough time for Outlook to shut down completely before attempting to open another form. Simple enough but often just an afterthought from an application point of view.

As an administrator you might want to preface applications that your end users might run, which would cause any ShowForm calls to be made, with a script or shell which checks first to make sure that Outlook has shutdown.

Lots of times in corporate environments the IT department is running applications that have been home grown – developed either on-site or by consultants. These are the applications that should be reviewed first while you, as an administrator, still have some control and access to the programmers.

As an administrator you should verify that any applications which open multiple forms, that are using Outlook as their forms server, remains in memory when the forms are being displayed. One solution is to have the applications create an Outlook.Application object. Outlook will load and continue to run until the Outlook.Application object is released. This will remove the timing issues associated with the Out of Memory errors that were previously experienced.

Subscribe to my RSS feed

Leave a Comment

Comment Policy