适用于Excel 2007的VSTO 4.0加载项Windows 7上的内存泄漏 [英] VSTO 4.0 Add-in for Excel 2007 Memory leak on Windows 7

查看:73
本文介绍了适用于Excel 2007的VSTO 4.0加载项Windows 7上的内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个用于Excel 2007的VSTO 4.0加载项,它似乎存在内存泄漏问题,但只有某些文档,仅在Windows 7上有问题。  ;该行为类似于LSTD代理问题,该问题在VSTO 4中得到了补救。 内存
在1.2到1.5 GB之间达到峰值,然后抛出OutOfMemory异常。  当我在Windows 7上运行时尝试打开某些文档时,似乎只会发生这种情况。如果我在XP中打开相同的文档,内存肯定会很高但我没有例外。
 基本上,我得到了各种例外而且从不在同一个地方两次:

We have a VSTO 4.0 Add-in for Excel 2007 that seems to have issues with Memory leaks, but only certain documents and only on Windows 7.  The behavior is similar to the LCID proxy issue that was supposedly remedied in VSTO 4.  The memory spikes at about 1.2 to 1.5 GB then throws an OutOfMemory Exception.  This only seems to happen when I try to open certain documents when runing on Windows 7.  If I open the same documents in XP, the memory certain goes high but I do not get an exception.  Basically, I get various exceptions and never in the same place twice:

-----来源:System.Windows.Forms -----

System.OutOfMemoryException:类型'System.OutOfMemoryException的异常'被抛出。

  在System.Windows.Forms.Screen.FromRectangle(Rectangle rect)

   at System.Windows.Forms.Screen.FromRectangle(Rectangle rect)

  在System.Windows.Forms.Screen.GetWorkingArea(Rectangle rect)

   at System.Windows.Forms.Screen.GetWorkingArea(Rectangle rect)

  在System.Windows.Forms.WindowsFormsUtils.ConstrainToScreenWorkingAreaBounds(矩形边界)

   at System.Windows.Forms.WindowsFormsUtils.ConstrainToScreenWorkingAreaBounds(Rectangle bounds)

  在System.Windows.Forms.ToolStripDropDown.GetDropDownBounds(Rectangle suggestedBounds)

   at System.Windows.Forms.ToolStripDropDown.GetDropDownBounds(Rectangle suggestedBounds)

  在System.Windows.Forms.ToolStripDropDown.SetBoundsCore(Int32 x,Int32 y,Int32 width,Int32 height,BoundsSpecified指定)

   at System.Windows.Forms.ToolStripDropDown.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)

  在System.Windows.Forms.Control.SetBounds(Int32 x,Int32 y,Int32 width,Int32 height,BoundsSpecified指定)

   at System.Windows.Forms.Control.SetBounds(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)

  在System.Windows.Forms.Control.set_Size(大小值)

   at System.Windows.Forms.Control.set_Size(Size value)

  在System.Windows.Forms.ToolStripDropDown.AdjustSize()

   at System.Windows.Forms.ToolStripDropDown.AdjustSize()

  在System.Windows.Forms.ToolStripDropDown.OnLayout(LayoutEventArgs e)

   at System.Windows.Forms.ToolStripDropDown.OnLayout(LayoutEventArgs e)

  在System.Windows.Forms.ToolStripDropDownMenu.OnLayout(LayoutEventArgs e)

   at System.Windows.Forms.ToolStripDropDownMenu.OnLayout(LayoutEventArgs e)

  在System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)

   at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)

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

   at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)

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

   at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)

  在System.Windows.Forms.ToolStripItem.InvalidateItemLayout(String affectedProperty,Boolean invalidatePainting)

   at System.Windows.Forms.ToolStripItem.InvalidateItemLayout(String affectedProperty, Boolean invalidatePainting)

  在System.Windows.Forms.ToolStripItem.InvalidateItemLayout(String affectedProperty)

   at System.Windows.Forms.ToolStripItem.InvalidateItemLayout(String affectedProperty)

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

   at System.Windows.Forms.ToolStripItem.OnRightToLeftChanged(EventArgs e)

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

   at System.Windows.Forms.ToolStripDropDownItem.OnRightToLeftChanged(EventArgs e)

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

   at System.Windows.Forms.ToolStripItem.OnOwnerChanged(EventArgs e)

  在System.Windows.Forms.ToolStripMenuItem.OnOwnerChanged(EventArgs e)

   at System.Windows.Forms.ToolStripMenuItem.OnOwnerChanged(EventArgs e)

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

   at System.Windows.Forms.ToolStripItem.SetOwner(ToolStrip newOwner)

  在System.Windows.Forms.ToolStripItemCollection.SetOwner(ToolStripItem item)

   at System.Windows.Forms.ToolStripItemCollection.SetOwner(ToolStripItem item)

  在System.Windows.Forms.ToolStripItemCollection.Add(ToolStripItem value)

   at System.Windows.Forms.ToolStripItemCollection.Add(ToolStripItem value)

   at Hcg.Stinger.Report.ShadowRangeTree.ShadowRangeNodeEventBehavior.AddDynamicLabelMenu()in C:\ Serenity6.x\Source\Hcg\Stinger\Report\ShadowRangeTree\ShadowRangeNodeEventBehavior.cs:line 135

   at Hcg.Stinger.Report.ShadowRangeTree.ShadowRangeNodeEventBehavior.AddDynamicLabelMenu() in C:\Serenity6.x\Source\Hcg\Stinger\Report\ShadowRangeTree\ShadowRangeNodeEventBehavior.cs:line 135

这是另一个:

 

-----来源:System.Windows.Forms ---- -

----- Source: System.Windows.Forms -----

System.OutOfMemoryException:抛出了类型'System.OutOfMemoryException'的异常。

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

  在System.Windows.Forms.ToolStripManager.ProcessShortcut(消息& m,键快捷键)

   at System.Windows.Forms.ToolStripManager.ProcessShortcut(Message& m, Keys shortcut)

  在System.Windows.Forms.ToolStripManager.ProcessCmdKey(消息& m,Keys keyData)

   at System.Windows.Forms.ToolStripManager.ProcessCmdKey(Message& m, Keys keyData)

   at System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg,Keys keyData)

   at System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg, Keys keyData)

  在System.Windows.Forms.Form.ProcessCmdKey(Message& msg,Keys keyData)

   at System.Windows.Forms.Form.ProcessCmdKey(Message& msg, Keys keyData)

  在System.Windows.Forms.Control.ProcessCmdKey(Message& msg,Keys keyData)

   at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)

  在System.Windows.Forms.Control.ProcessCmdKey(Message& msg,Keys keyData)

   at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)

   at System.Windows.Forms.TextBoxBase.ProcessCmdKey(Message& msg,Keys keyData)

   at System.Windows.Forms.TextBoxBase.ProcessCmdKey(Message& msg, Keys keyData)

  在System.Windows.Forms.Control.PreProcessMessage(Message& msg)

   at System.Windows.Forms.Control.PreProcessMessage(Message& msg)

   at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target,Message& msg)

   at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)

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

   at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)

----------

----------

当我将文档保存为独立文档,并且不使用VSTO加载项打开它们,它能够以最少的内存打开它们。  当我使用add in来打开它们时,那​​就是当事情旋转并崩溃时。
When I save the documents as stand alone docs and do not open them using the VSTO Add-in, it is able to open them with minimal memory.  When I use the add in to open them, that's when things spin up and crash.

推荐答案

嗨Erick,

Hi Erick,

我试图解决你在线程中提出的问题 -

I have tried to address the questions you have asked in the thread -

1)这与LCID问题无关,因为无论系统文化如何,都会发生这种情况。您是否仅在将系统区域设置为非en-us时遇到此问题?

1) This should not be related to LCID issue as that occurs irrespective of system culture. Are you facing this issue only when you set the system culture to non en-us?

2)LCID问题已在.Net framework 4.0中修复。

2) LCID issue is fixed in .Net framework 4.0.

3)我不认为这应该是一个Excel(应用程序)问题,因为文档在没有你的插件的情况下打开正常。

3) I don't think this should be an Excel (application) issue as document opens fine without your add-in.

4)这是特定于你的插件的东西对象未正确释放的位置。这里给出的调用堆栈可能无济于事,因为Out of Memory可能来自任何被拒绝内存的语句。

4) This is something specific to your add-in where object are not being released properly. Call stack given here may not help because Out of Memory can arise from any statement which is denied the memory.

通过比较Win-XP的行为很难说出这个问题。 Windows 7操作系统的操作系统。我建议您遵循行动计划 -

It is difficult to say anything about this issue by comparing the behavior of Win-XP OS with Windows 7 OS. I would suggest you following action plan -

a)在开始获取异常之前,您提到内存峰值为1.5 GB - 如果您在循环中实例化对象,可以检查代码吗?或者来自计时器而不是正确地释放它们。

a) You mentioned that memory spike to 1.5 GB before you start getting the exceptions - Could you check in your code if you are instantiating objects in a loop or from a timer and not releasing them properly.

b)对于释放内存的Excel特定最佳实践 - 请参阅文章
http://support.microsoft.com/kb/317109/en-us 并确保遵循这些做法。

b) For Excel specific best practices of releasing the memory - please refer to article http://support.microsoft.com/kb/317109/en-us and make sure you follow those practices.

c)如果以上几点没有任何线索,您是否可以创建缩小的代码来重现此问题。我相信这将是困难的,甚至可能是不可能的,但我们需要这个进一步排除故障,没有任何其他痕迹等。

c) If above points give no clue, Could you create a scaled down code to reproduce this issue. I am sure this will be difficult and even may not be possible but we will need this to further troubleshoot without any other traces etc.

d)如果上面没有帮助,你可能想要使用Microsoft支持打开支持服务单以进行更深入的分析。请访问以下链接,查看可以更好地满足您需求的各种付费支持选项。
http://support.microsoft.com/default.aspx?id= fh; en-us; offerprophone  

d) If above doesn't help, you may want to open a support ticket with Microsoft Support for more in depth analysis. Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone 

 


这篇关于适用于Excel 2007的VSTO 4.0加载项Windows 7上的内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆