C# SetVisible、CreateHandle和没有足够的存储空间可用于处理此命令

C# SetVisible、CreateHandle和没有足够的存储空间可用于处理此命令,c#,.net,vb.net,C#,.net,Vb.net,我在一堆应用程序上得到了以下堆栈跟踪。它们可以正常工作几周,然后有一天——BOOM,每次调用任何应用程序时,都会出现相同的错误。重新开机似乎能让我多活几周。以下是发生错误时我看到的stacktrace: System.ComponentModel.Win32Exception: Not enough storage is available to process this command at System.Windows.Forms.NativeWindow.WindowClass.Re

我在一堆应用程序上得到了以下堆栈跟踪。它们可以正常工作几周,然后有一天——BOOM,每次调用任何应用程序时,都会出现相同的错误。重新开机似乎能让我多活几周。以下是发生错误时我看到的stacktrace:

System.ComponentModel.Win32Exception: Not enough storage is available to process this command
   at System.Windows.Forms.NativeWindow.WindowClass.RegisterClass()
   at System.Windows.Forms.NativeWindow.WindowClass.Create(String className, Int32 classStyle)
   at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
   at System.Windows.Forms.Control.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.OnParentVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.ScrollableControl.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.Form.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Control.set_Visible(Boolean value)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at Ellin.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81

我在谷歌上搜索了这个,每个人都在谈论IRPStackSize,但我不知道它与这个错误有什么关系,因为这个堆栈跟踪与网络无关。。。应用程序刚开始运行时就死掉了。

您能分享一段代码吗?这段代码在出现此错误的应用程序中很常见?可能与WinForms默认设置有所不同?特定桌面上的应用程序从一个堆进行分配。当然,正常情况下,用户的桌面。当桌面堆的存储空间不足时,将出现此错误。您启动的每个应用程序都会崩溃,这表明此泄漏可能不是由您的应用程序引起的。您必须找到作恶者,请访问superuser.com寻求指导。我如何检查桌面堆的大小?您的应用程序是否运行了数周?可能您正在泄漏UI资源。不,该应用程序在一天中多次启动和关闭。不幸的是,我不能真正确定导致这种情况的代码,因此不能真正共享整个应用程序。