none
Memory Leak RRS feed

  • Question

  • Having the following memory leak issue with Outlook 2010 32 Bit running on Windows 7 Enterprise 64 bit.

    Adding the "Categories" property to an Outlook.Table object causes the Outlook.exe process to memory leak, eventually result in Outlook becoming unusable / crashing. Is there a fix or work around for this?

    Example code below demonstrates the issue when run repeatedly in a .NET application. Remove the categories line and no leak in Outlook.exe occurs.:

    Private Sub MemoryLeakTest()

            Dim objOutlookApplication As Outlook.Application

            objOutlookApplication = CreateObject("Outlook.Application")

            Dim objNamespace As Outlook.NameSpace = objOutlookApplication.GetNamespace("MAPI")

            Dim objOutlookFolder As Outlook.Folder

            objOutlookFolder = objNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)

            Dim objTable As Outlook.Table = objOutlookFolder.GetTable("", Outlook.OlTableContents.olUserItems)

            objTable.Columns.Add("Categories")

            objTable.Columns.Add("Attachment")

            objTable.Columns.Add("SentOn")

            objTable.Columns.Add("Importance")

            objTable.Columns.Add("SenderName")

            objTable.Columns.Add("To")

            objTable.Columns.Add("Size")

            objTable.Columns.Add("Unread")

            objTable.Columns.Add("ReceivedTime")

            objTable.Columns.Add("http://schemas.microsoft.com/mapi/proptag/0x66700102")

            objTable.Columns.Add("FlagStatus")

            objTable.Columns.Add("FlagDueBy")

            objTable.Sort("Attachment", True)

            Dim objArray(,) As Object

            objArray = objTable.GetArray(10000)

            objTable = Nothing

            objOutlookFolder = Nothing

            objNamespace = Nothing

            objOutlookApplication = Nothing

        End Sub

    • Moved by Max Meng Friday, June 1, 2012 2:03 AM moving to a more appropriate forum (From:Outlook IT Pro Discussions)
    Thursday, May 31, 2012 10:34 AM

Answers

  • Hi Jim,

    This is a bug in Outlook 2007 & Outlook 2010 and will be addressed in future updates for both products.

    Dave


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members.



    Friday, June 29, 2012 1:08 PM

All replies

  • Since it is coding related question so I have moved it to Outlook for Developers forum.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    Max Meng

    TechNet Community Support

    Friday, June 1, 2012 2:07 AM
  • Hi Jim,

    Offhand I'm not aware of this issue, but Categories is a multi-valued property, so it doesn't exactly surprise me that you are having an issue with this property. I'll do some testing and let you know if I can reproduce this problem. If I can, then I suspect the only real option here would be for you to open a support incident so that we can pursue getting a hotfix for this. But that's just an educated guess at this point.

    The only other questions I have off the top of my head would be whether it's just that specific bitness of Office/Windows that is a problem (I suspect not), and whether you have tried removing all other add-ins to make sure they are not coming into play somehow.


    Bill Jacob - Microsoft Customer Service & Support - Developer Messaging

    Monday, June 4, 2012 8:46 PM
    Moderator
  • Hi Jim,

    I can't seem to reproduce this with the most recent Outlook 2010 32-bit build on Win7 64-bit and using the equivalent VBA code:

    Private Sub MemoryLeakTest()
      Set objOutlookFolder = Session.GetDefaultFolder(olFolderInbox)
      Set objTable = objOutlookFolder.GetTable("", olUserItems)
      objTable.Columns.Add "Categories"
      objTable.Columns.Add "Attachment"
      objTable.Columns.Add "SentOn"
      objTable.Columns.Add "Importance"
      objTable.Columns.Add "SenderName"
      objTable.Columns.Add "To"
      objTable.Columns.Add "Size"
      objTable.Columns.Add "Unread"
      objTable.Columns.Add "ReceivedTime"
      objTable.Columns.Add "http://schemas.microsoft.com/mapi/proptag/0x66700102"
      objTable.Columns.Add "FlagStatus"
      objTable.Columns.Add "FlagDueBy"
      objTable.Sort "Attachment", True
      Dim objArray()
      objArray = objTable.GetArray(10000)
    End Sub

    Can you try this Outlook VBA code to see if it's also causing problems for you? This would be a good way to help narrow down the scope of the problem.

    Also, please check if the problem is related to the actual data in the folder. Does this problem consistently happen with other folders as well?


    Bill Jacob - Microsoft Customer Service & Support - Developer Messaging

    Tuesday, June 5, 2012 2:54 PM
    Moderator
  • Bill

    The leak can be easily replicated in both VBA and an external .NET program. My test case involves a folder with @4000 items of which 1000 have 3 categories assigned to them. The leak gets worse (mathematically it looks like a linear progression to me on the private byte count of Outlook.exe) the more items in the folder that have a category (or categories) assigned to them. With no items in the folder categorised, the leak is still there but harder to notice. when not including the category property in the Add columns request, no leak is observable. I have tested this with all add-ins disabled on Version 14.0.6112.5000 which is the fully patched (via Windows Update) version to end of April 2012 and likewise for the OS.

    I suspect the leak is not in the MAPI provider but rather the Outlook API's implementation of it as I can retrieve the property using Redemption with no leak. Redemption however causes a memory leak in retrieving the long term entry id property (although not in Outlook.exe) which the developer believes is caused by the MAPI provider (but interestingly this does not leak via the Outlook implementation).

    Any further help you can give will be very much appreciated as resolving this is key to our organisations move to Office 2010.

    Regards

    Jim Nolan

    Wednesday, June 6, 2012 7:57 PM
  • Hi Jim,

    My apologies, I incorrectly thought I had applied categories to my test data, but I didn't. I'm blaming the script :) Now that I have the categories applied, I can see the leak. I believe the only other workarounds would be to retrieve the data by iterating through the items (slow), or using Extended MAPI (not supported from managed code).

    Can you open a support incident for this? If so, please let me know the incident number so I can follow up on that.

    Thanks!


    Bill Jacob - Microsoft Customer Service & Support - Developer Messaging

    Wednesday, June 6, 2012 8:52 PM
    Moderator
  • Bill

    Many thanks for your extremely prompt response. I am very happy to open a support incident but......you may have deduced that I might know a bit about software development but it has been many years since I have had to raise a support incident (which is a pretty good thing in itself and says a lot about Microsoft's software I think!).  I am embarrased to admit that I am not exactly sure how to go about it. Could you steer me in the right direction please?

    Regards

    Jim

    Wednesday, June 6, 2012 9:10 PM
  • Jim, if your organization has a Premier Support contract, then it would be best to submit an incident through that. If not, then you can submit a "Professional" incident via this link and then choose Outlook 2010: http://support.microsoft.com/select/default.aspx?target=assistance&c1=505&. Alternatively, you can submit an incident via the MSDN web site if you have a subscription, some subscriptions may come with included incidents (I say "may" because I'm not up on the latest on that). The key, though, is to submit a "Pro" incident (for developers or IT Pros). Either way, you will likely need to pay up-front but this is clearly a bug it would be refunded later on. Again, please let me know the incident number so I can make sure it gets routed to my team.


    Bill Jacob - Microsoft Customer Service & Support - Developer Messaging

    Wednesday, June 6, 2012 10:52 PM
    Moderator
  • Bill

    I have submitted an incident under my MSDN subscription, the number is 112060738462112.

    Regards

    Jim

    Thursday, June 7, 2012 10:42 AM
  • Bill

    Any progress on this?

    Regards

    Jim

    Tuesday, June 12, 2012 6:22 PM
  • Hi Jim,

    I am still investigating this.

    Dave

    Tuesday, June 12, 2012 6:29 PM
  • Hi Jim,

    This is a bug in Outlook 2007 & Outlook 2010 and will be addressed in future updates for both products.

    Dave


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members.



    Friday, June 29, 2012 1:08 PM
  • Hi Dave,

    If you are on it...
    I had similar issue - memory leak upon using .IncludeRecurrences=True while filtering appointments (only on OL2010)
    Any chance it would be solved too?

    Thanks!

    Friday, June 29, 2012 2:40 PM
  • Hi Moshe,

    Please start a new thread for this issue or if you have a consistent repro you can open a support case.

    Dave

    Friday, June 29, 2012 3:21 PM