有时我会收到错误
Win32Exception 没有足够的存储空间来处理此命令
应用程序运行大约一个月左右后。
这对应于
ERROR_NOT_ENOUGH_MEMORY (8)
通常,它作为 Windows 服务运行,并且更改其登录的用户仍然会导致错误发生。但是,如果我通过双击运行该应用程序,它就可以正常工作。它可以再次作为 Windows 服务运行的唯一方法是重新启动服务器。
该错误出现在应用程序写入的日志中。完整的错误是:
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.Application.MarshalingControl..ctor()
at System.Windows.Forms.Application.ThreadContext.get_MarshalingControl()
at System.Windows.Forms.WindowsFormsSynchronizationContext..ctor()
at System.Windows.Forms.WindowsFormsSynchronizationContext.InstallIfNeeded()
at System.Windows.Forms.Control..ctor(Boolean autoInstallSyncContext)
at System.Windows.Forms.ScrollableControl..ctor()
at System.Windows.Forms.ContainerControl..ctor()
at System.Windows.Forms.Form..ctor()
at LicensingModule.LicenseKeyValidator..ctor(String Name, String Path)
at MIDICOMExporter.Program.Main(String[] args)
我看到其他答案说这与服务器上的内存泄漏有关,但是如果双击时应用程序仍然可以运行,这是否仍然意味着可能存在内存泄漏?
此外,它运行在 Windows Server 2012 上。
是的,该问题可能与服务器上的内存泄漏有关。也许是桌面堆 http://blogs.msdn.com/b/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx已耗尽。 “非交互式”窗口会话的桌面堆与真实(交互式)桌面会话的桌面堆不同。这解释了为什么双击应用程序仍然是可能的。
尝试找到注册表项 \System\CurrentControlSet\Control\Session Manager\SubSystem 并增加第三个参数 (zzz)SharedSection=xxx,yyy,zzz
如中所述MSKB 126962 https://support.microsoft.com/en-us/kb/126962(对于 yyy)。
第三个 SharedSection 值 (512) 是桌面堆的大小
对于与“非交互式”窗口关联的每个桌面
车站。
如果这解决了您的问题,则由于资源泄漏等原因引起的堆耗尽可能是问题的根源。默认情况下,“非交互式”桌面堆的大小比标准堆小得多。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)