简体   繁体   English

如何调试“没有足够的存储空间来处理此命令”

[英]How to debug “Not enough storage is available to process this command”

We've started to experience Not enough storage available to process this command . 我们已经开始体验Not enough storage available to process this command The application is WPF , the exception starts to pop up after some hours of working normally. 该应用程序是WPF ,异常开始在正常工作几个小时后弹出。

System.ComponentModel.Win32Exception (0x80004005): Not enough storage is available to process this command
   at MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D wc_d)
   at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks)
   at System.Windows.Interop.HwndSource.Initialize(HwndSourceParameters parameters)
   at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
   at System.Windows.Window.CreateSourceWindowDuringShow()
   at System.Windows.Window.SafeCreateWindowDuringShow()
   at System.Windows.Window.ShowHelper(Object booleanBox)
   at System.Windows.Window.Show()
   at System.Windows.Window.ShowDialog()

My understanding is this is some kind of out of memory exception, specific to allocation of windows resources . 我的理解是这是某种内存不足的异常,具体分配给windows resources What is the possible reason of this and how can I debug it? 可能的原因是什么,我该如何调试?


Update 更新

I have reviewed the topic suggested by @Thili77 ( this one ). 我已经回顾了@Thili77( 这个 )提出的主题。 I used GDIView and task manager to look at the consumed handles during our app performing (Handles, USER Objects and GDI objects in taskmgr), and it doesn't look like they are growing. 我使用GDIView和任务管理器来查看应用程序执行期间消耗的句柄(taskmgr中的句柄,USER对象和GDI对象),看起来它们看起来并不像它们正在增长。 My next test is to try to run it for a day without VS (previously it was running under VS host process) and check whether this still happens. 我的下一个测试是尝试在没有VS的情况下运行它一天(之前它在VS主机进程下运行)并检查是否仍然发生这种情况。 I'm still looking for any advices or tips if anybody has any 如果有人的话,我仍在寻找任何建议或提示

Update #2 It happens on a new clean PC without hosting VS. 更新#2它发生在没有托管VS的新干净PC上。 The handles, USER Objects and GDI Objects are OK during crash. 在崩溃期间,句柄,USER对象和GDI对象都可以。 When the PC in a crashed state, nothing works properly - looks like the handles are really leaked, but ProcMon doesn't show big numbers for these values. 当PC处于崩溃状态时,没有任何工作正常 - 看起来手柄真的泄露了,但ProcMon没有显示这些值的大数字。 Also weirdly this always happens around 7-8 pm, when there is nobody in the office and it doesn't matter when I started the app run. 奇怪的是,这总是发生在下午7点到8点左右,当时办公室里没有人,当我启动应用程序运行时无关紧要。 It is already a third crash like that. 这已经是第三次崩溃了。 Coincidence? 巧合? Only thing that I've notice I find weird is a big number of page faults for the app, that grows constantly. 只有我注意到我觉得奇怪的是应用程序的大量页面错误,它不断增长。 Could this be related? 这有关系吗? Does not appear anymore, see Update #3 不再出现,请参阅更新#3

Update #3 更新#3

Next are the details of a crash I experience. 接下来是我遇到的崩溃的细节。 The system is x86, app is x86, W7 SP1. 系统是x86,app是x86,W7 SP1。 The current state that is shown on the screenshots are exactly right after the crash, with windbg that pauses the process. 屏幕截图中显示的当前状态正好在崩溃之后,windbg暂停了该过程。 For some reason now the exception has different message: The operation completed successfully . 由于某种原因,现在异常有不同的消息: The operation completed successfully But it still the same Win32Exception coming from the same piece of code. 但它仍然是来自同一段代码的相同的Win32Exception。

I also need to pinpoint that I'm running with reduced amount of desktop heap and with AppAnalyzer Basic options on - in order to make the fault more frequent (which seems to work). 我还需要确定我运行的桌面堆数量减少,并且启用了AppAnalyzer Basic选项 - 以便使故障更频繁(这似乎有效)。 The time assumption was indeed a coincidence, no time related shared theme noticed anymore. 时间假设确实是巧合,没有时间相关的共享主题再次注意到。 系统信息 流程 MyApp流程信息

One possibility is that the global atom table has run out of available space. 一种可能性是全局原子表已用尽可用空间。 There is a limit of 0x4000 string atoms in the table, and there is also a limit on the total amount of space allocated to the table. 表中有0x4000个字符串原子的限制,并且分配给表的空间总量也有限制。 Window classes are one of the things that go into this table. 窗口类是此表中的一个内容。

I have never attempted to debug such an issue myself, but I did find an article about checking for this problem using WinDbg: Identifying Global Atom Table Leaks . 我自己从未尝试过调试此类问题,但我确实找到了一篇关于使用WinDbg检查此问题的文章: 识别全局原子表泄漏 You might want to look into that as a possible cause. 您可能希望将其视为可能的原因。

If this turns out to be the culprit, one possible cause is that the application is not closing Window instances. 如果这是罪魁祸首,一个可能的原因是应用程序没有关闭Window实例。 HwndWrapper cleans up its global atom in its Dispose, which happens in response to WM_DESTROY, which happens in response to calling Close on the Window (or setting DialogResult , which ends up closing the window if the value changes and the window was shown by calling ShowDialog rather than Show). HwndWrapper在其Dispose中清除其全局原子,这是响应于WM_DESTROY而发生的,响应于调用Window上的Close (或设置DialogResult ,如果值改变则最终关闭窗口,并且通过调用ShowDialog显示窗口)而不是显示)。 There may be other possible causes for an atom leak as well. 原子泄漏也可能有其他可能的原因。

PS The reason I suspect this is because "Not enough storage is available to process this command" is the error that is returned when RegisterClassEx is unable to add to the global atom table. PS我之所以怀疑这是因为“没有足够的存储空间来处理此命令”是当RegisterClassEx无法添加到全局原子表时返回的错误。

Looks like an issue which was not resolved on purpose by Microsoft, check this Connect link , in which it was stated: 看起来像Microsoft没有故意解决的问题,请查看此Connect链接 ,其中说明了:

We appreciate the feedback. 我们感谢您的反馈。 However, this issue will not be addressed in the next version of WPF. 但是,下一版本的WPF将不会解决此问题。 Thank you. 谢谢。 –WPF Team. -WPF团队。

A workaround is provided, it might help: 提供了一种解决方法,它可能有所帮助:

You can work around this bug by adding the following code to your thread proc: 您可以通过将以下代码添加到线程proc来解决此错误:

 Dispatcher dispatcher = Dispatcher.CurrentDispatcher; dispatcher.BeginInvokeShutdown(DispatcherPriority.Normal); Dispatcher.Run(); 

This asks the dispatcher associated with the thread to shut down right away. 这要求与线程关联的调度程序立即关闭。

From my experience I received that type of exception in case your UI thread hangs up and other threads continue placing messages to main application UI dispatcher. 根据我的经验,我收到了这种类型的异常,以防你的UI线程挂断,其他线程继续向主应用程序UI调度程序发送消息。 So in the some period of type the message queue is full and than you will recieve this exception. 因此,在某些类型的消息队列中,消息队列已满,您将收到此异常。

To debug that you may need find your thread 1(which is UI) in VS during debug session and monitor it's activities. 要调试,您可能需要在调试会话期间在VS中找到您的线程1(这是UI)并监视它的活动。 Maybe there is some infinite waiter on some external event or etc. 也许在某些外部事件等上有一些无限的服务员。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 诊断“没有足够的存储空间来处理此命令”异常 - Diagnose “Not enough storage is available to process this command” exception 没有足够的存储空间可用于在Visual Studio 2008中处理此命令 - Not enough storage is available to process this command in VisualStudio 2008 没有足够的存储空间可用于在RSA加密中处理此命令 - Not enough storage is available to process this command In RSA Encryption “没有足够的存储空间来处理此命令。” 互斥量 - “Not enough storage is available to process this command.” for Mutex Win32Exception 没有足够的存储空间来处理此命令 - Win32Exception Not enough storage is available to process this command C# - “没有足够的存储空间来处理此命令”异常消息 - C# - "Not enough storage is available to process this command" exception message 没有足够的存储空间来处理此命令(VS编译,运行时) - Not enough storage is available to process this command (VS compile, runtime) Microsoft Report Viewer 2012异常“没有足够的存储空间来处理此命令” - Microsoft Report Viewer 2012 exception “Not enough storage is available to process this command” MemoryMappedFile CreateViewAccessor抛出“没有足够的存储空间来处理此命令。” - MemoryMappedFile CreateViewAccessor throws “Not enough storage is available to process this command.” 除了IRPStackSize外,您是否对“没有足够的存储空间来处理此命令”有任何想法。 - Do you have any idea about “Not enough storage is available to process this command.”, except IRPStackSize
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM