2010-09-23 54 views
1

我們有一個VSTO 4.0插件,用於Excel 2007,似乎存在內存泄漏問題,但只有某些文檔且僅在Windows 7上。行爲類似到在VSTO 4中應該補救的LCID代理問題。內存峯值大約在1.2到1.5 GB之間,然後引發OutOfMemory異常。當我在Windows 7上運行時嘗試打開某些文檔時,似乎只發生這種情況。如果我在XP中打開相同的文檔,內存肯定會變高,但我沒有發現異常。基本上,我得到的各種異常,從來沒有在同一個地方兩次:VSTO 4.0 Excel 2007插件在Windows 7上導致內存泄漏

-----來源:System.Windows.Forms的-----

的System.OutOfMemoryException:類型的異常「System.OutOfMemoryException的'被拋出。

在System.Windows.Forms.Screen.FromRectangle(矩形RECT)

在System.Windows.Forms.Screen.GetWorkingArea(矩形RECT)

在System.Windows.Forms.WindowsFormsUtils.ConstrainToScreenWorkingAreaBounds (矩形範圍)

在System.Windows.Forms.ToolStripDropDown.GetDropDownBounds(矩形suggestedBounds)

在System.Windows.Forms.ToolStripDropDown.SetBoundsCore(的Int32的x,的Int32 Y,的Int32寬度,的Int32高度,BoundsSpecified指定)

在System.Windows.Forms.Control.SetBounds(的Int32的x,的Int32 Y,的Int32寬度,高度的Int32,BoundsSpecified指定)

在System.Windows.Forms.Control的。 set_Size(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參數)

在System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement,字符串affectedProperty)

在System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout,IArrangedElement elementCausingLayout,String屬性)

在System.Windows.Forms.ToolStripItem.InvalidateItemLayout(字符串affectedProperty,布爾invalidatePainting)

在System.Windows.Forms.ToolStripItem.InvalidateItemLayout(字符串affectedProperty)

在System.Windows.Forms.ToolStripItem.OnRightToLeftChanged(EventArgs的)

在System.Windows.Forms.ToolStripDropDownItem.OnRightToLeftChanged (EventArgs的)

在System.Windows.Forms.ToolStripItem.OnOwnerChanged(EventArgs的)

在System.Windows.Forms的。ToolStripMenuItem.OnOwnerChanged(EventArgs五)

在System.Windows.Forms.ToolStripItem.SetOwner(ToolStrip的newOwner)

在System.Windows.Forms.ToolStripItemCollection.SetOwner(ToolStripItem的項目)

的系統。 Windows.Forms.ToolStripItemCollection.Add(ToolStripItem的值)

在Hcg.Stinger.Report.ShadowRangeTree.ShadowRangeNodeEventBehavior.AddDynamicLabelMenu()在C:\ Serenity6.x \來源\ HCG \毒刺\報告\ ShadowRangeTree \ ShadowRangeNodeEventBehavior.cs :135行

這裏的另一個問題:

-----來源:System.Windows.Forms的-----

的System.OutOfMemoryException:類型的System.OutOfMemoryException「引發的異常。

在System.Windows.Forms.ToolStripManager.ProcessShortcut(消息&米,鍵的快捷方式)

在System.Windows.Forms.ToolStripManager.ProcessCmdKey(消息&米,鑰匙KEYDATA)

在系統.Windows.Forms.ContainerControl.ProcessCmdKey(消息& MSG,鑰匙KEYDATA)

在System.Windows.Forms.Form.ProcessCmdKey(消息& MSG,鑰匙KEYDATA)

在System.Windows.Forms.Control.ProcessCmdKey(消息& MSG,鑰匙KEYDATA)

在System.Windows.Forms.Control.ProcessCmdKey(消息& MSG,鑰匙KEYDATA)

在System.Windows .Forms.TextBoxBase.ProcessCmdKey(消息& MSG,鑰匙KEYDATA)

在System.Windows.Forms.Control.PreProcessMessage(消息& MSG)

在System.Windows.Forms.Control.PrePr ocessControlMessageInternal(控制目標,消息& MSG)

在System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG & MSG)


當我保存爲獨立的文件,不打開文件他們使用VSTO插件,它能夠以最小的內存打開它們。當我使用添加來打開它們時,就是當事情發生並崩潰時。

任何幫助或指示爲什麼Windows 7有這些問題將不勝感激。

感謝,

埃裏克

回答

0

其實,我想通了該應用程序對TreeNodes的上下文菜單創造成千上萬ToolStripMenuItems的。一旦我分享了這些內容,它就會處理內存問題。

+0

你是什麼意思「一旦我讓這些共享...」?我也有內存問題和ContextMenuStrip控件包含各種ToolStripMenuItems。但我不知道如何讓他們「共享」。你能幫我嗎? – jreichert 2015-01-16 17:14:44

+0

@jreichert我分享的意思是簡單地將它們添加到樹menucontext中。我一直爲每個節點創建單個的。我只是使用規則來決定哪些節點顯示哪個節點。 – Erick 2015-01-16 21:59:07