Re: Not enough storage space
- From: João Paulo Figueira <joao.figueira@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 15 Jun 2006 17:59:22 +0000 (UTC)
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.
.
- References:
- Re: Not enough storage space
- From: sardo007
- Re: Not enough storage space
- Prev by Date: Re: Not enough storage space
- Next by Date: Re: Initializing SQL Server Reconciler has failed
- Previous by thread: Re: Not enough storage space
- Next by thread: Initializing SQL Server Reconciler has failed
- Index(es):
Relevant Pages
|