【发布时间】:2011-04-15 03:46:09
【问题描述】:
我们有一个用于 Excel 2007 的 VSTO 4.0 加载项,它似乎存在内存泄漏问题,但仅限于某些文档且仅在 Windows 7 上。该行为类似于据称在 VSTO 4 中得到解决的 LCID 代理问题。内存峰值大约为 1.2 到 1.5 GB,然后引发 OutOfMemory 异常。这似乎只发生在我尝试在 Windows 7 上运行时打开某些文档时。如果我在 XP 中打开相同的文档,内存肯定会变高,但我没有遇到异常。基本上,我得到了各种例外,而且从来没有在同一个地方两次:
----- 来源:System.Windows.Forms -----
System.OutOfMemoryException:引发了“System.OutOfMemoryException”类型的异常。
在 System.Windows.Forms.Screen.FromRectangle(Rectangle rect)
在 System.Windows.Forms.Screen.GetWorkingArea(Rectangle rect)
在 System.Windows.Forms.WindowsFormsUtils.ConstrainToScreenWorkingAreaBounds(矩形边界)
在 System.Windows.Forms.ToolStripDropDown.GetDropDownBounds(RectangleSuggestedBounds)
在 System.Windows.Forms.ToolStripDropDown.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified 指定)
在 System.Windows.Forms.Control.SetBounds(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
在 System.Windows.Forms.Control.set_Size(大小值)
在 System.Windows.Forms.ToolStripDropDown.AdjustSize()
在 System.Windows.Forms.ToolStripDropDown.OnLayout(LayoutEventArgs e)
在 System.Windows.Forms.ToolStripDropDownMenu.OnLayout(LayoutEventArgs e)
在 System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
在 System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement 影响元素,字符串影响属性)
在 System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String 属性)
在 System.Windows.Forms.ToolStripItem.InvalidateItemLayout(字符串影响属性,布尔 invalidatePainting)
在 System.Windows.Forms.ToolStripItem.InvalidateItemLayout(字符串影响属性)
在 System.Windows.Forms.ToolStripItem.OnRightToLeftChanged(EventArgs e)
在 System.Windows.Forms.ToolStripDropDownItem.OnRightToLeftChanged(EventArgs e)
在 System.Windows.Forms.ToolStripItem.OnOwnerChanged(EventArgs e)
在 System.Windows.Forms.ToolStripMenuItem.OnOwnerChanged(EventArgs e)
在 System.Windows.Forms.ToolStripItem.SetOwner(ToolStrip newOwner)
在 System.Windows.Forms.ToolStripItemCollection.SetOwner(ToolStripItem 项)
在 System.Windows.Forms.ToolStripItemCollection.Add(ToolStripItem 值)
在 C:\Serenity6.x\Source\Hcg\Stinger\Report\ShadowRangeTree\ShadowRangeNodeEventBehavior.cs:第 135 行中的 Hcg.Stinger.Report.ShadowRangeTree.ShadowRangeNodeEventBehavior.AddDynamicLabelMenu() 处
这是另一个:
----- 来源:System.Windows.Forms -----
System.OutOfMemoryException:引发了“System.OutOfMemoryException”类型的异常。
在 System.Windows.Forms.ToolStripManager.ProcessShortcut(Message& m, Keys shortcut)
在 System.Windows.Forms.ToolStripManager.ProcessCmdKey(Message& m, Keys keyData)
在 System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg, Keys keyData)
在 System.Windows.Forms.Form.ProcessCmdKey(Message& msg, Keys keyData)
在 System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
在 System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
在 System.Windows.Forms.TextBoxBase.ProcessCmdKey(Message& msg, Keys keyData)
在 System.Windows.Forms.Control.PreProcessMessage(Message& msg)
在 System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
在 System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
当我将文档保存为独立文档并且不使用 VSTO 插件打开它们时,它能够以最少的内存打开它们。当我使用插件打开它们时,就会出现问题并崩溃。
任何有关 Windows 7 为何存在这些问题的帮助或指示将不胜感激。
谢谢,
埃里克
【问题讨论】:
标签: vsto excel-2007