此异常消息中引用的“配额"是什么:没有足够的配额可用于处理此命令 [英] What 'quota' is being referred to in this exception message: Not enough quota is available to process this command

查看:71
本文介绍了此异常消息中引用的“配额"是什么:没有足够的配额可用于处理此命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个抛出以下异常的 .NET 应用程序:

I have a .NET application that throws the following exception:

System.ComponentModel.Win32Exception : Not enough quota is available to process this command 
   at MS.Win32.UnsafeNativeMethods.PostMessage(HandleRef hwnd, Int32 msg, IntPtr wparam, IntPtr lparam) 
   at MS.Win32.ManagedWndProcTracker.HookUpDefWindowProc(IntPtr hwnd) 
   at MS.Win32.ManagedWndProcTracker.OnAppDomainProcessExit() 
   at MS.Win32.ManagedWndProcTracker.ManagedWndProcTrackerShutDownListener.OnShutDown(Object target) 
   at MS.Internal.ShutDownListener.HandleShutDown(Object sender, EventArgs e)

我个人无法重现此异常,但我从用户那里收到了很多异常报告.

I can't reproduce this exception personally, but I get lots of exception reports from users.

所指的配额"是什么?堆栈跟踪让我相信这可能是 Windows 消息队列的问题.

What is the 'quota' being referred to? The stack trace leads me to believe that it might be a problem with the Windows message queue.

有关可能导致此错误的原因或如何解决此错误的任何想法将不胜感激.

Any ideas about what might cause this error, or how to fix it would be greatly appreciated.

编辑,更多信息:这是在所有机器上的 32 位 Windows XP 上,例外不在 我的 代码中,而是一个 .NET Framework 事件某种处理程序.应用程序本身不进行任何 PostMessage 调用.

EDIT, further info: This is on 32 bit Windows XP on all machines, and the exception is not in my code as such, but a .NET Framework event handler of some sort. The application itself does not make any PostMessage calls.

推荐答案

进程可以分配的特定类型的 Windows 资源量在技术上仅受可用虚拟内存量的限制一个过程.这可能是一个相当大的数字,尤其是在 64 位版本的 Windows 上.其中一些资源是从内部堆中取出的,所有其他进程也从中取出.如果 Windows 允许一个进程使用它,仍然是一个非常大的数字.

The amount of Windows resources of a specific type that a process could allocate is technically only restricted by the amount of virtual memory available to a process. Which can be a rather large number, especially on the 64-bit version of Windows. Some of these resources are withdrawn from an internal heap from which all other processes withdraw as well. Still a very large number if Windows would let one process consume it all.

这当然没有意义,永远不应该允许进程吞噬所有可用资源.这就是配额的作用,它为某种类型的资源计数设置了上限.常见的例子是 10,000 个窗口、10,000 个 GDI 对象、10,000 个句柄.顺便说一句,并非所有这些都是很好的整数.

Which of course doesn't make sense, a process should never be allowed to gobble up all available resources. Which is what a quota does, it sets an upper limit to the counted number of resources of a certain type. Common examples are 10,000 windows, 10,000 GDI objects, 10,000 handles. Not all of them are nice round numbers like this btw.

需要更多地了解您的 PostMessage() 调用的作用,但合理的猜测是它正在推动消息队列大小超过配额.同样,这种资源在技术上仅限于可用虚拟内存的大小.但实际上应该保持在南边.如果准确,您发布消息的速度比它们可以消耗的速度快,则需要进行节流.这发生在确切程序终止的时间表明可能需要另一种解释.可能是线程关闭顺序问题.

It would take knowing more about what your PostMessage() call does, but a reasonable guess is that it is pushing the message queue size past the quota. Again, a resource that's technically only limited to the size of available virtual memory. But practically should stay well south of that. If accurate, you are posting messages faster than they can be consumed, throttling is required. That this happens at the exact time your program is terminating suggests another explanation might be necessary. A thread shutdown order problem, maybe.

这篇关于此异常消息中引用的“配额"是什么:没有足够的配额可用于处理此命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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