none
Not enough storage is available to complete this operation

    Question

  • I get this exception after awhile of browsing thru my application, i dunno what causes this because it never happens in the same place. I would like to know if anyone else is experiencing this situation and if there is a solution.

    SqlCeException
    Not enough storage is available to complete this operation.

    em System.Data.SqlServerCe.SqlCeConnection.ProcessResults()
    em System.Data.SqlServerCe.SqlCeConnection.Open()
    em System.Data.SqlServerCe.SqlCeConnection.Open()
    em System.Data.Common.DbDataAdapter.QuietOpen()
    em System.Data.Common.DbDataAdapter.FillInternal()
    em System.Data.Common.DbDataAdapter.Fill()
    em System.Data.Common.DbDataAdapter.Fill()
    Thursday, October 26, 2006 4:48 AM

Answers

  • The problem is actually because of DLL Squeeze.  To get around this problem, please open a connection to SQL Server Mobile database at the very beginning of your application.

    [Note: You will face this problem on the very first instance of accessing SQL Server Mobile that is when we load all our binaries and if there is not enough memory we will fail with the above error]

    Thanks,

    Laxmi

    Monday, November 06, 2006 7:54 PM

All replies

  • The problem is actually because of DLL Squeeze.  To get around this problem, please open a connection to SQL Server Mobile database at the very beginning of your application.

    [Note: You will face this problem on the very first instance of accessing SQL Server Mobile that is when we load all our binaries and if there is not enough memory we will fail with the above error]

    Thanks,

    Laxmi

    Monday, November 06, 2006 7:54 PM
  • I get the same message but it is not on my first connection to the database. I am opening and closing connections to fill drop down lists with typed datasets using table adapters throughout my application. Everything seems to go ok until durring one search I try to fill a table with one row of about 25 columns.

    Is a strongly typed dataset of 1 row and 25 columns too much to hold in memory on a mobile device? Also I only seem to have the problem with the emulators.

    Thanks,

    Patrick

    Monday, November 27, 2006 4:43 PM
  • I used GC.Collect() for solving the problem... Now it's working!
    Some unmanaged resources are not released.
    • Proposed as answer by Benjamin Lambe Monday, December 19, 2011 4:09 PM
    Wednesday, July 18, 2007 10:38 AM
  •  

    I'm experiencing this problem as well. The app I'm working on uses the Visual Studio 2005 generated TableAdapter to access a SQL CE table.  Our application is written in C# using .NET CF 2.0 SP2, with SQL CE 3.0.

     

    I'm running a stress test where I run my application for several hours.  I'm seeing the error after about 30 hours of constant usage (adding, deleting, updating, reading).

     

    I've googled for this error and have read a few other threads (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1321878&SiteID=1, http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=2033891&SiteID=17), and MS KB articles (http://support.microsoft.com/kb/824462, http://support.microsoft.com/kb/834279/)

     

    I've tried sprinking GC.Collect() calls into my app but they do not make a difference.

     

    From reading these other posts and KB articles, I gather that using a single SqlCeConnection is recommended, as well as making sure Dispose/Close methods are properly called.  From what I can tell, the auto-generated code uses a single SqlCeConnection, and caches SqlCeCommand objects.

     

    I've used NETCFRPM and it doesn't appear that there is a growing number of Sql objects staying around.

     

    I'm working on a test app to reproduce the problem, but it will be several hours before I know if I've reproduced the error.

     

    For those of you who've encountered this, does your code use the auto-generated TableAdapter's? Or are you manually connection to a SQL CE database?

    Monday, September 10, 2007 7:40 PM
  • WildcatWarrior,

     

    we are facing the same problem as you! cf 2, SQL mobile/compact 3.0 or 3.1.

     

     

    I just wonder if you have it fixed? and how?

     

    we use the tableadapter is auto-generated in the dataset so there is no "selectcommand" to dispose as what other people said.

     

     

     

    thank you!

    Friday, November 09, 2007 9:51 AM
  • ErikEJ,

     

    thank you for the link and I have look at that. acutally, currently, we have only SQL compact running on the PDA. and we check the memory, we still have 90MB free left so I don't think memory is the issue. we also check all dll, everythign is there.

     

    the problem is that, we keep on doing the same process and it works fine in the first few, when we reach to about 20, it pops up that message, "Not enough storage is available to complete this operation", when we check the memory, it is still 90MB so everything is fine. without exit the application we click on our other button to query other table, then it is fine without any problem. then we close that result and click on the problem query again, we still get that message.

     

    we also try put GC.collect() to the finally but it doens't fix the problem.

     

    we also try to conver the above VB to C# abut we get error "aaTableAdapter does not contain a definition for 'commandcollection'" and no "System.Data.sqlclient"

     

     

    we are currently running c# CF, SQL compact (3.1),

     

    we have read we need to dispose the selectcommand but we cannot find a way to dispose it since the tableadpator is autogenerated and I think it is private so we cannot access it from outside.

     

     

     

     

    other people's solution but no sqlclient so I change to sqlserverCe.sqlcecommand however, I still cannot get this.CommandCollection[0]..

     

    here is my code I type into aaDataSet.cs:

     

    namespace app1{

    partial class aap1DataSet

    {

    public partial class aaTableAdapter

    {

    public System.Data.SqlServerCe.SqlCeCommand selectcommand

    {

    get { return this.CommandCollection[0]; }   //ERROR. cannot find the commandacollection

    }

    }

    }

    }

    }

     

     

     

     

    here is other people post to solve the problem:


    Namespace myDataSetTableAdapters
        Partial Class myTableAdapter

            Public ReadOnly Property selectcommand() As System.Data.SqlClient.SqlCommand
                Get
                    Return Me.CommandCollection(0)
                End Get

            End Property

        End Class
    End Namespace

     

     

     

     

     

     

     

    Saturday, November 10, 2007 4:08 AM
  • Try to call

     

    sqlCeCommand.Dispose();

    sqlCeCommand = null;

     

    before you call GC.Collect

     

     

    ref: http://support.microsoft.com/kb/824462

    Wednesday, July 14, 2010 12:51 AM