.net 没有足够的存储空间来完成此操作 - 程序或存储内存?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2881419/
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
Not enough storage is available to complete this operation - Program or Storage memory?
提问by Grant Crofton
I've been given a Windows Mobile app written in .Net CF 3.5 to fix, and one of the problems is to do with storage.
我得到了一个用 .Net CF 3.5 编写的 Windows Mobile 应用程序来修复,其中一个问题与存储有关。
The message 'Not enough storage is available to complete this operation' has appeared a few times - it's logged in the SQL CE database, and always happens during data access (but not the same bit of data access).
消息“没有足够的存储空间可用于完成此操作”出现了几次 - 它记录在 SQL CE 数据库中,并且总是在数据访问期间发生(但不是同一位数据访问)。
The thing I'm slightly confused about is whether this refers to Program Memory (e.g. RAM) or Storage Memory (e..g permanent storage). It would appear to be storage memory, but the devices seem to have plenty free. While there are some OutOfMemoryExceptions, these appear totally unrelated to this problem (in that that happen at a different time due to an image-related issue).
我有点困惑的是,这是指程序内存(例如 RAM)还是存储内存(例如永久存储)。它似乎是存储内存,但这些设备似乎有足够的空闲空间。虽然有一些 OutOfMemoryExceptions,但这些似乎与这个问题完全无关(因为与图像相关的问题发生在不同的时间)。
We're using SQL CE 3.5 with a single connection, which is stored along with the app on the device (as opposed to the storage card). The device is a Motorola MC75 running Windows Mobile 6.1.
我们将 SQL CE 3.5 与单个连接一起使用,该连接与应用程序一起存储在设备上(与存储卡相反)。该设备是运行 Windows Mobile 6.1 的摩托罗拉 MC75。
Any thoughts?
有什么想法吗?
回答by Hans Passant
It is a low-level Windows error, code 14, ERROR_OUTOFMEMORY. The error message doesn't mention "memory" because it isn't always caused by running out of memory. The most typical trigger is a program exceeding its quota of kernel resources. Like 10,000 window handles, there are many others. That's for the desktop edition btw, I don't doubt it is much lower on Windows Mobile.
这是一个低级别的 Windows 错误,代码 14,ERROR_OUTOFMEMORY。错误消息没有提到“内存”,因为它并不总是由内存不足引起的。最典型的触发器是程序超出其内核资源配额。像 10,000 个窗口句柄一样,还有很多其他的。顺便说一句,这是针对桌面版的,我不怀疑它在 Windows Mobile 上要低得多。
Well, the program is a piggy. One possible way to trigger this error is to not call Dispose() on objects of classes that implement IDisposable. That will consume kernel resources that won't be released until the garbage collector and finalizer thread run. Which could take a while. The SQL CE classes are certainly a candidate. If you have no clue where the resource leak or over-usage is coming from then invest in a profiler that works on CF.
嗯,这个程序是个小猪。触发此错误的一种可能方法是不对实现 IDisposable 的类的对象调用 Dispose()。这将消耗在垃圾收集器和终结器线程运行之前不会被释放的内核资源。这可能需要一段时间。SQL CE 类当然是一个候选。如果您不知道资源泄漏或过度使用的来源,那么请投资在 CF 上运行的分析器。
回答by TrustyCoder
How much virtual memory is allocated? Try increasing the value if possible.
分配了多少虚拟内存?如果可能,请尝试增加该值。
回答by C.Evenhuis
I don't know if this also applies for MC75, but on Start->Settings->Control Panel->Systemthere should be a Memory tab, where you can adjust how much memory is available as RAM, and how much is reserved for storing files.
我不知道这是否也适用于 MC75,但Start->Settings->Control Panel->System应该有一个“内存”选项卡,您可以在其中调整多少内存可用作 RAM,以及保留多少内存用于存储文件。
This does not apply to the \Permanent Storage folder (or \Storage Card, as it's called on our device), but to the other folders, like \Temp.
这不适用于 \Permanent Storage 文件夹(或 \Storage Card,因为它在我们的设备上被称为),但适用于其他文件夹,如 \Temp。

