PowerPoint 2010内存泄漏?... [英] PowerPoint 2010 memory leak?...
问题描述
您好,
我正在为Microsoft PowerPoint开发自定义插件。我的插件需要将大量二进制数据存储到PowerPoint演示文稿中。我将这个二进制数据作为基本64位编码字符串存储到PowerPoint演示文稿标签我发现,当演示文稿
在其标签中包含大量数据(例如10+兆字节)时,PowerPoint在保存演示文稿时似乎会泄漏内存。因此,当这样的演示文稿多次保存时,PowerPoint甚至会耗尽系统内存并崩溃。
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.
我开发了一个非常简单的C#插件来隔离问题。它在创建新演示文稿时将50兆字节的二进制数据存储到演示文稿中:
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);
}
}
运行此插件后,我甚至可以禁用它确保它不再做任何事情。接下来,我多次保存演示文稿,并在每次保存演示文稿时看到进程列表中的PowerPoint内存使用量增长。
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
有谁知道它是PowerPoint错误还是有解决方法?...
Does anyone know if it is a PowerPoint bug or is there any workaround for this?...
推荐答案
我无法重现你的场景。
I cannot reproduce your scenario.
您可以禁用其他插件,看看是否可以再次重现此方案。
You can disable other addins and see whether you can reproduce this scenario again.
这篇关于PowerPoint 2010内存泄漏?...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!