Re: Problems programmatically creating items in PSTs with Outlook 2003

Tech-Archive recommends: Speed Up your PC by fixing your registry



Why do you think there is a memory leak? I am guessing that as soon as you
create the first message in a PST store, PST provider initializes something
and keeps it in memory.
As long as the memory usage does not go up with each new message created in
the same PST, I personally wouldn't worry about it.
Also note that MAPI has its own memory allocator, so when a MAPI memory
block is released using MAPIFreeBuffer, it is not necessarily released back
to Windows; at least not immediately.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Chris" <chrisf@xxxxxxxxxxxxxxxx> wrote in message
news:E36B7E6B-1D71-46DA-B355-7EA0BEC09EE1@xxxxxxxxxxxxxxxx
> (Re-posted from office.developer.com.add_ins)
>
> I have a test application that simply creates a PST file, creates a an
> empty
> message within it and saves the item. This process of creating another PST
> file and message within it is repeated ten times.
>
> The code flow is:
>
> for (int n = 1; n < 11 ; n++)
> {
> CComPtr<IMAPIFolder> pDestRootFolder;
> CComPtr<IMessage> pDestinationMessage;
>
> {Create a PST file of filename c:\test_n.pst}
>
> pDestRootFolder = {the root folder of the generated PST}
>
> pDestRootFolder->CreateMessage(NULL, 0, &pDestinationMessage);
> pDestinationMessage->SaveChanges(FORCE_SAVE);
>
> {Write out the value of 'n' and process' memory usage}
>
> }
>
>
> When this program is run on a system with Outlook 2003 base or SP1
> installed, it behaves correctly. However, after I upgraded Outlook 2003 to
> SP2, a memory leak of approximately 3-4MB is observed after the first
> message
> was written to each new PST file:
>
> PST file written Memory used (KB)
> 1 13,144
> 2 16,680
> 3 20,168
> 4 23,660
> 5 27,144
> 6 30,632
> 7 34,124
> 8 37,676
> 9 41,160
> 10 44,716
>
> After some more investigation, I could reproduce this memory leak on 4 out
> of 5 PCs with Outlook 2003 SP2 installed. Comparing the Outlook dlls that
> were installed on these PCs, the only noticeable difference was the
> version
> of Outlfltr.dll installed. On the PCs where the memory leak was observed,
> V1.2.32.1 of Outlfltr.dll was installed. On the PC where there was no
> memory
> leak V1.4.2607.0 was installed.
>
> On one of the PCs with Outlfltr.dll V1.2.32.1 installed, I performed an
> Office update and installed the latest Junk Email Filter update for
> Outlook
> 2003 SP2. This installed Outlfltr.dll V1.4.2607.0 and the memory leak
> disappeared.
>
> Could anybody explain why the Outlook Junk Email Filter dll would cause a
> memory leak with programmatically creating messages in a PST?
>
> Thanks in advance,
> Chris
>


.



Relevant Pages