Not enough storage is available to complete this operation

  • Thread starter Thread starter Hafsteinn Gunnarsson
  • Start date Start date
H

Hafsteinn Gunnarsson

I am selecting from my SqlCe database on the PPC and get the errormessage :
Not enough storage is available to complete this operation.

But it occurs randomly in the program, not at the same position for each
time I run the application.

I am building a tree from the data and connect to the database at the
beginning and then disconnect when the tree is built.

Any ideas what this message meen and why it occurs and what I can do about
it?

Thanks,
Hafsteinn
 
Sounds like it reads a lot of data from database, and occupied a mass of
memory.
PPC will adjust storage and application memory space automatically, but when
your app keeps reading data (DataReader of DataAdapter), its adjustment
can't
catch up, and the OutOfMemory exception is likely to happen. And that is why
it
occurs randomly.
So, did you read a big amount of data as I said? I guess you use DataReader?

Maybe you can try to read a piece of data to test how much memory size it
will take
after you built the tree, and then try to find out the approximate memory
size
you will need totally.

If the total size reachs the memory space, it's hard to do. However, you can
try
NOT to read all of data at the first time, and read the child node data when
user
expand a node. That will get some overhead, but it is better than block the
program and tell user this error message.

Jan Yeh
 
-----Original Message-----
I am selecting from my SqlCe database on the PPC and get the errormessage :
Not enough storage is available to complete this operation.

But it occurs randomly in the program, not at the same position for each
time I run the application.

I am building a tree from the data and connect to the database at the
beginning and then disconnect when the tree is built.

Any ideas what this message meen and why it occurs and what I can do about
it?

Thanks,
Hafsteinn


.
I was also experiencing this problem and reported it to
MSDN. After about two weeks, they discovered a
deallocation issue with the command object. Make sure to
dispose all objects before they fall out of scope. I
can't remember the exact code, but if you are using a
data adapter the following is close:
C#
da.SelectCommand.Dispose();

The reason you are getting the error is that the garbage
collector is not able to keep up with memory that has
fallen out of scope. Make sure to call dispose. FYI, my
emulator continued showing the error randomly, but the
Pocket PC device did not.

Good luck,

John Cobb
 
Back
Top