Click to See Complete Forum and Search --> : ADO+JET BLOB memory leak


Philip White
April 25th, 1999, 10:58 AM
The MS VC++ sample "AdoChunk" (workspace "CAdoVcChunk.dsw") demonstrates
a recommended way to update BLOBs using the "import" extensions and AppendChunk(). The sample allows you to load a text file and write that to a binary column in a sample database "GetChunk.mdb." Since text files are usually pretty small any memory leaks doesn't show up.

OK, to simulate a larger BLOB, I changed one line -


void CAdoVcChunkDlg::BlobToVariant(VARIANT &varArray)
{
...
// rgsabound[0].cElements = m_csValue.GetLength() * sizeof(TCHAR) + sizeof (TCHAR);
rgsabound[0].cElements = 1000000; // Force BLOB to be 1MB rather than the text file length
...
}




If you try this, monitor the program's memory usage with NT4 Task Manager,
then add a record, you'll see the memory usage go up by about 1MB.
Interesting ?

I have looked into this at length; the problem occurs whether you use the
OLEDB ODBC provider "msdasql", which is what this sample is using, or if
you explicitly use the native OLE DB provider "Microsoft.Jet.OLEDB.4.0" or
"Microsoft.Jet.OLEDB.3.51". Yes, it happens on JET 3.51 as well. It does not
seem to occur with SQL Server 7.0, although SQL Server 7 seems much slower
at writing a 1MB BLOB.

Anyone else experienced this, or understand what is going on ?

Thanks
Philip White