oracle System.Runtime.InteropServices.COMException (0x80070008): 没有足够的存储空间来处理此命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2435186/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
System.Runtime.InteropServices.COMException (0x80070008): Not enough storage is available to process this command
提问by Darryl Braaten
I am trying to diagnose this exception :
我正在尝试诊断此异常:
System.Runtime.InteropServices.COMException (0x80070008): Not enough storage is available to process this command. (Exception from HRESULT: 0x80070008)
at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(Type objectType)
at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(Type serverType)
at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type serverType, Object[] props, Boolean bNewObj)
at Oracle.DataAccess.Client.CThreadPool..ctor()
at Oracle.DataAccess.Client.OracleCommand.set_CommandTimeout(Int32 value)
...
It does not look like any of the normal types of "storage" have hit any limits. The application is using about 400MB of memory, 70 threads, 2000 handles and the hard drive has many GB free. The machine is running Windows 2003 Enterprise Server 32bit with 16GB of RAM so memory shouldn't be an issue.
看起来任何正常类型的“存储”都没有达到任何限制。该应用程序使用了大约 400MB 的内存、70 个线程、2000 个句柄,并且硬盘驱动器有许多 GB 可用空间。该机器运行 Windows 2003 Enterprise Server 32 位和 16GB 内存,因此内存应该不是问题。
The application is running as a windows service so there are no GDI objects being used. Running out of GDI handles is a common cause of this exception.
该应用程序作为 Windows 服务运行,因此没有使用 GDI 对象。用完 GDI 句柄是此异常的常见原因。
Database connections, commands & readers are all all wrapped with using blocks so they should be getting cleaned up correctly.
数据库连接、命令和读取器都被 using 块包裹,因此它们应该被正确清理。
UPDATE:Reducing the number of threads we were using from 12 to 4 seems to have fixed the issue. We managed to run with no errors for over 24 hours, before we were lasting between 4 and 8 hours. UPDATE2:I never figured out what resource we were running out of, but reducing the number of threads seems to have fixed the problem. Or at least hid it.
更新:将我们使用的线程数从 12 减少到 4 似乎已经解决了这个问题。在持续 4 到 8 小时之前,我们设法无错误地运行了 24 小时以上。 UPDATE2:我从来没有想过我们用完了什么资源,但减少线程数似乎解决了这个问题。或者至少隐藏它。
回答by JaredPar
Another factor you need to consider is memory fragmentation.
您需要考虑的另一个因素是内存碎片。
The maximum single allocation you can perform is equal to the largest contiguous block of memory available to the process. This is almost always less than the total amount of memory available in the process because of fragmentation. That is allocated blocks of memory sitting in between 2 free blocks of memory "fragments" the space.
您可以执行的最大单个分配等于进程可用的最大连续内存块。由于碎片,这几乎总是小于进程中可用的内存总量。即分配的内存块位于 2 个空闲内存块“碎片”空间之间。
The more fragmentation you have in the process the smaller the largest contiguous block of memory that will be available. I've seen situations where there was close to 1GB of memory free but the largest contiguous block was around 10MB.
进程中的碎片越多,可用的最大连续内存块就越小。我见过有接近 1GB 可用内存但最大连续块约为 10MB 的情况。
Have you checked for memory fragmentation in this process?
在这个过程中你检查过内存碎片吗?
回答by Hans Passant
You did eliminate all the obvious sources of this error for your process. Makes it likely that this is actually an operating system issue. The one resource that is always under pressure on a server is the kernel memory pool. It is easy to see, TaskMgr.exe displays it on the Performance tab.
您确实为您的流程消除了此错误的所有明显来源。很可能这实际上是操作系统问题。服务器上始终处于压力之下的一种资源是内核内存池。很容易看到,TaskMgr.exe 将其显示在“性能”选项卡上。
It somewhat matches your call stack, looks like the Oracle provider is creating threads for a thread pool. A thread takes a megabyte in your process and24 KB in the kernel memory pool, used as a stack when the thread switches to kernel mode.
它有点匹配您的调用堆栈,看起来 Oracle 提供程序正在为线程池创建线程。一个线程需要在过程中兆字节,并在内核内存池24 KB,作为当线程切换到内核模式栈。
Background info is available here.
背景信息可在此处获得。
回答by Richard Anthony Hein
Looks like something is looping and instantiating too many objects on the heap so you are running out of memory on the heap. Look for any loops in the calling code.
看起来有些东西正在循环并在堆上实例化太多对象,因此堆上的内存不足。在调用代码中查找任何循环。