Re: Not enough storage space



Hello sardo007,

After a quick look I see no apparent problem, but your last question gave me a good hint. From my own experience the OLE DB provider will leak memory if you do not destroy all objects you created. So the answer for your last question is: none - destroy all the objects.

Regards,
João Paulo Figueira
eMVP

Hi João.. thanks for your reply...

I've tried to close the data source and the session, but the problem
persists. Maybe I'm not doing it right. The code I use to open the
connection is something like this:

hr = CoCreateInstance (CLSID_SQLSERVERCE_2_0, 0, CLSCTX_INPROC_SERVER,
IID_IDBInitialize, (void**)&m_spInit);

if (FAILED(hr))
return hr;
dbprop[0].dwPropertyID=DBPROP_INIT_DATASOURCE;
dbprop[0].dwOptions =DBPROPOPTIONS_REQUIRED;
dbprop[0].vValue.vt=VT_BSTR;
dbprop[0].vValue.bstrVal=strConnString.AllocSysString ();
if(NULL == dbprop[0].vValue.bstrVal)
return hr =E_OUTOFMEMORY;
dbpropset[0].guidPropertySet =DBPROPSET_DBINIT;
dbpropset[0].rgProperties=dbprop;
dbpropset[0].cProperties=sizeof(dbprop)/sizeof(dbprop[0]);
if (FAILED (hr = m_spInit ->QueryInterface (IID_IDBProperties, (void
**)&spIDBProperties)))
{// Error
VariantClear(&dbprop[0].vValue);
return hr;
}// Error
if (FAILED (hr =spIDBProperties ->SetProperties(1, dbpropset)))
{// Error
VariantClear(&dbprop[0].vValue);
return hr;
}// Error
if (FAILED (hr =m_spInit->Initialize()))
{// Error
VariantClear(&dbprop[0].vValue);
return hr;
}// Error
VariantClear(&dbprop[0].vValue);
//
ATLASSERT(m_spInit != NULL);
if (FAILED (hr =m_spInit->QueryInterface(IID_IDBCreateSession,
(void**)&spSession)))
return hr;
if (FAILED (hr =spSession ->CreateSession(NULL, IID_IOpenRowset,
(IUnknown**)&m_spOpenRowset)))
return hr;
When I close the connection, the code I use is this:

m_spOpenRowset.Release ();
m_spOpenRowset =NULL;
if (FAILED (hResult = m_spInit ->Uninitialize ()))
return hResult;
m_spInit.Release();
m_spInit =NULL;

m_spInit and m_spOpenRowset are member variables inside the Connection
object (I have only one in the application) When I reopen the
connection I first call the Close function which does the cleanup
above and then I open it again... This process does not seem to free
up any memory since the amount of forms is still the same.

Do you see anything worng in the code above? Or any suggestion about
the way to open/close the connection and which oledb objects are safe
to keep/destroy in each cycle?

Thank you very much for your help.

"João Paulo Figueira" wrote:

Hello sardo007,

I have seen this problem happening as well. Closing or even
destroying (releasing) the command objects does not seem to help (SQL
CE 2.0). The only solution I have found that will help is to
periodically close the data source and the session. This will
actually release the memory or, as I experienced it, will put a
ceiling on how much memory is used.

Regards,
João Paulo Figueira
eMVP
Hello, after searching this topic everywhere it seems nobody is
facing it the same way.

I'm developing an evc++ 4.0 database application using sqlce 2.0 and
oledb (adoce gave me some problems so I discarded it) Application
behaves well on every option, except one in which the user has to
introduce lots of data in a form. Data is selected from lists that
are populated with related data in other database tables. The
form-filling is OK, but after the user completes 10 or more forms
the application stops executing ICommands with the error "not enough
storage to complete this operation".

I've found this error in many places but they all seem to be
.NET-oriented. Since the target of my application is PocketPC 2003
and even PocketPC 2002 (yes, there are still plenty of these all
over there) I can't use VC2005 to develop the application, so the
problem has to be solved using what I'm using (evc++4, sqlce2 and
OLEDB) Every solution I've found tells about Disposing the
recordsets and commands, but in the OLEDB interfaces I use there is
no such Dispose method, since they are all Released() as COM objects
are.

The problem does not seem to be with the available storage memory
(there are more than 20MB of program space available and the
application has not been running long enough to fragment all that
space) It seems the sqlce dll or the oledb driver has some limit
with the memory used internally, since the problem occurs always
after a fixed form-filling sequence.

Any ideas are welcome. Thanks in advance.



.



Relevant Pages

  • Re: Not enough storage space
    ... I've tried to close the data source and the session, ... When I close the connection, the code I use is this: ... This will actually release the memory or, as I experienced it, ... oledb Application ...
    (microsoft.public.sqlserver.ce)
  • Re: VFP Updates?
    ... Try talking ODBC or OleDb and they say HU. ... make up my apps so that what ever they want to run has to be from a command ... kind of connection and assign it the right to do exactly what you want. ...
    (microsoft.public.fox.programmer.exchange)
  • RE: oledb & locale problem
    ... connection is ok now :-) ... Subject: oledb & locale problem ... client sdk we copy some files onto gls directory. ...
    (comp.databases.informix)
  • Re: Repost: Sql Server 2005: SSIS "OleDb Data Source" problems (MSDN Universal Subscriber)
    ... > I am not quite sure about for Informix because there is on buitl in OLE ... select the Informix oledb provider you want to use ... You could double click the data connection you created to see the ... > | The All Tab provides Connection Time, Data Source, Extended Properties, ...
    (microsoft.public.sqlserver.dts)
  • Re: Strange sudden shutdown issue with CF app
    ... Phone devices are notoriously low on virtual memory right out of the box because the OEMs decide to put every little thing into its own DLL and then have 25 processes launched at boot. ... Chris Tacke, Embedded MVP ... We have created an app that basically connects to a web service gets data, then stores it locally on the device, and when a record needs to be modified/added the system first tries to connect the web server sees if its availible, if not then it stores in locally on the device until the connection comes back, now I noticed that if the device does not mess around with the data connection then the application sits nicely as long as its open, and never gets shut down. ... But again most of the time I get no exception at all but just simply disappears. ...
    (microsoft.public.dotnet.framework.compactframework)