none
PowerPoint 2010 memory leak?... RRS feed

  • Question

  • Hello,

    I developing a custom addin for Microsoft PowerPoint. My addin needs to store large amount of binary data into PowerPoint presentation. I store this binary data as base 64 encoded strings into PowerPoint presentation tags. I found, that when presentation contains huge amount of data in its tags (like 10+ megabytes), PowerPoint seems to be leaking memory when saving the presentation. So when such presentation is saved multiple times, PowerPoint even my run out of system memory and crash.

    I developed a very simple C# addin to isolate the issue. It stores 50 megabytes of binary data into presentation when new presentation is created:

            private void Application_AfterNewPresentation(PowerPoint.Presentation presentation)
            {
                int tagLength = 5 * 1000 * 1000;
                StringBuilder largeTagValue = new StringBuilder();
                largeTagValue.Capacity = tagLength + 2;
                for (int i = 0; i < tagLength; i++)
                {
                    largeTagValue.Append("A");
                }
                largeTagValue.Append("\0");
                string largeTagValueString = largeTagValue.ToString();
                for (int i = 0; i < 10; i++)
                {
                    presentation.Tags.Add("LARGE_TAG" + i.ToString(), largeTagValueString);
                }
            }


    After running this addin, I may even disable it to make sure that it not does anything more. Next, I am saving the presentation multiple times and see that PowerPoint memory usage in process list grows each time I save the presentation.

    The complete source code and sample presentation is available here

    Does anyone know if it is a PowerPoint bug or is there any workaround for this?...

    Or, maybe there is another way to store relatively large amount of data into PowerPoint presentation?


    • Moved by Max Meng Wednesday, March 20, 2013 3:02 AM
    • Edited by LostByte Friday, March 22, 2013 11:53 AM
    Tuesday, March 19, 2013 9:25 AM

All replies

  • I cannot reproduce your scenario.

    You can disable other addins and see whether you can reproduce this scenario again.


    with regards, Yuri

    Friday, March 22, 2013 7:14 AM
  • Yury, thank you for the response. I am always able to reproduce it, even if all PowerPoint addins are disabled. I updated my previous post and put a link to download complete source code and the presentation. To reproduce this issue you can just open the presentation from 'SamplePresentation' folder and just press Ctrl+S multiple times. In task manager you will see that memory usage grows each time, and grows significantly each time after presentation is saved. I was able to reproduce this issue on several machines.

    TagStoragePresentation.pptx is just a very simple presentation containing 50 megabytes of binary data in its tags.


    • Edited by LostByte Friday, March 22, 2013 11:54 AM
    Friday, March 22, 2013 8:17 AM
  • Hi LostByte,

    See my response on http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f735f1d4-57dd-4026-ae27-2fae6f796e7f -- the issue described there seems to be exactly what you're showing, and the workarounds described therein should be applicable for your case as well.

    Hope this helps,

    - Michael


    Michael Zlatkovsky | Program Manager, Visual Studio Tools for Office & Apps for Office


    Wednesday, March 27, 2013 5:54 PM
  • Hi Michael,

    Thank you very much for your response. I have just read all your replies you posted on the thread you suggested and performed a bit more research on my isssue. The results are:

    - I see, that  undo stack in PowerPoint is empty when I open the attached "TagStorageTest" presentation and save it multiple times. I am not expecting undo stack to grow since I am not doing any modifications in the presentation when opening it and saving multiple times.

    - If I open  "TagStorageTest" presentation, save it multiple times, then close and reopen it - the PowerPoint memory is not being cleared.

    - If I save "TagStorageTest" presentation as binary .ppt file, and after that save it multiple times - PowerPoint memory usage not grows. So it seems the issue is happening only with .pptx files, and saving as .ppt is a possible solution.

    So we can tell our users to always save their presentation as PowerPoint 2003-2007 to avoid this issue, but this may be confusing for them... 

    Is there any other solution you can suggest to avoid this issue?.. Please also let me know if you have any problems with reproducing the issue and I will give you more detailed instructions.

    Thanks again for quick and helpful answer.

    Thursday, March 28, 2013 7:24 AM
  • Hi LostByte,

    I temporarily marked the reply as answer. You can unmark it if it provides no help.

    Please feel free to let us know if you need any help.

    Have a nice day.


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 3, 2013 6:46 AM
    Moderator
  • Hi LostByte,

    Apologies for the delay, I had been on vacation for a week.

    I have contacted some folks on the PowerPoint team, so hopefully they should be able to investigate this issue and respond to you.  If you've still not heard back in a week or so, feel free to "ping" this thread, and I'll see if I can get someone else involved on this.

    Best of luck!

    - Michael


    Michael Zlatkovsky | Program Manager, Visual Studio Tools for Office & Apps for Office

    Monday, April 8, 2013 7:45 PM
  • A developer from the PowerPoint team replied, and asked if you could share the repro files and explicit steps to reproduce the memory increases.  If you could upload the files to SkyDrive (or just email them to me directly at michael.zlatkovsky@microsoft.com), I can pass that information onto the developer for further investigation.

    It would also be useful to know what tool are you using to track PPT memory usage.  Likewise, when you close the PPT file, does the PPT process remain?  The more information we have, the higher the chance there's something we can do with it :-)

    Thanks,

    - Michael


    Michael Zlatkovsky | Program Manager, Visual Studio Tools for Office & Apps for Office

    Monday, April 8, 2013 8:36 PM
  • Thank you very much Michael! I very happily will provide any information you need for this issue. I will send you an email describing this problem. I hope we will end with a good solution for it!
    Friday, April 12, 2013 12:45 PM