Not enough storage is available to complete this operation - Program or Storage memory?
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.
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).
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).
We're using SQL CE 3.5 with a single connection, which is stored along with the app on the device (as oppo开发者_如何转开发sed to the storage card). The device is a Motorola MC75 running Windows Mobile 6.1.
Any thoughts?
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.
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.
How much virtual memory is allocated? Try increasing the value if possible.
I don't know if this also applies for MC75, but on Start->Settings->Control Panel->System
there should be a Memory tab, where you can adjust how much memory is available as RAM, and how much is reserved for storing files.
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.
精彩评论