juresmith
June 4th, 2006, 02:27 PM
I develop an application using Visual Studio .NET 2002, Managed C++. My computer, on which runs my problematic application, has 256 MB of RAM.
I have a problem with a big memory consumption when I perform loading of data into a DataSet using OleDbDataAdapter.Fill() method. When my application is started, it initially has 17,548 K. Furthermore, SELECT statement selects, for example, 4 records form database and the Mem Usage in Windows Task Manager/Process showed 32,760 K for my application. Furthermore, my SELECT statement selects, for example, 318540 records from database and, of course, it is a lot of data. OleDbDataAdapter.Fill() method was performed again and the Mem Usage showed 152,456 K for my application. But when I call this method for the next time, the Mem Usage starts to increase a bit more and starts to oscillate around 152,000 K (for example, in a range from 102,000 K to 167,000 K). The execution of this method last long and all application which currently run on Windows work more slowly. However, when, after these steps, my SELECT statement selects, for example, 4 records from database, the Mem Usage decrease to 105,896 K. Now, there is a very big consumption of memory when a DataSet consists of little number of records. How can I decrease this big memory occupation of my application when a real set of selected records are small?
Click "Event handler" of my loading button is as follows:
StringBuilder* str = new StringBuilder(S"SELECT Calls.Call_ID, Calls.Line, Calls.Extension, Calls.DialedNumber, Calls.Code, Calls.CallType, Calls.Pulses, Calls.Duration, Calls.DateOfCall, Calls.PriceOfCall FROM Calls WHERE (((Calls.DateOfCall) Between #1/1/2004# And #6/4/2006 23:59:59#)) ORDER BY Calls.DateOfCall");
daCalls->SelectCommand->CommandText = str->ToString();
dsCalls->Clear();
daCalls->Fill(dsCalls);
dvTitles->Sort = S"DateOfCall ASC";
dvTitles->RowFilter = S"";
where
DataGrid* dgTitles;
OleDbConnection* dbConn;
OleDbDataAdapter* daCalls;
DataSet* dsCalls;
DataView* dvTitles;
and
dvTitles = new DataView(dsCalls->Tables->Item[0], S"", S"DateOfCall ASC", DataViewRowState::CurrentRows);
dgTitles->DataSource = dvTitles;
I have a problem with a big memory consumption when I perform loading of data into a DataSet using OleDbDataAdapter.Fill() method. When my application is started, it initially has 17,548 K. Furthermore, SELECT statement selects, for example, 4 records form database and the Mem Usage in Windows Task Manager/Process showed 32,760 K for my application. Furthermore, my SELECT statement selects, for example, 318540 records from database and, of course, it is a lot of data. OleDbDataAdapter.Fill() method was performed again and the Mem Usage showed 152,456 K for my application. But when I call this method for the next time, the Mem Usage starts to increase a bit more and starts to oscillate around 152,000 K (for example, in a range from 102,000 K to 167,000 K). The execution of this method last long and all application which currently run on Windows work more slowly. However, when, after these steps, my SELECT statement selects, for example, 4 records from database, the Mem Usage decrease to 105,896 K. Now, there is a very big consumption of memory when a DataSet consists of little number of records. How can I decrease this big memory occupation of my application when a real set of selected records are small?
Click "Event handler" of my loading button is as follows:
StringBuilder* str = new StringBuilder(S"SELECT Calls.Call_ID, Calls.Line, Calls.Extension, Calls.DialedNumber, Calls.Code, Calls.CallType, Calls.Pulses, Calls.Duration, Calls.DateOfCall, Calls.PriceOfCall FROM Calls WHERE (((Calls.DateOfCall) Between #1/1/2004# And #6/4/2006 23:59:59#)) ORDER BY Calls.DateOfCall");
daCalls->SelectCommand->CommandText = str->ToString();
dsCalls->Clear();
daCalls->Fill(dsCalls);
dvTitles->Sort = S"DateOfCall ASC";
dvTitles->RowFilter = S"";
where
DataGrid* dgTitles;
OleDbConnection* dbConn;
OleDbDataAdapter* daCalls;
DataSet* dsCalls;
DataView* dvTitles;
and
dvTitles = new DataView(dsCalls->Tables->Item[0], S"", S"DateOfCall ASC", DataViewRowState::CurrentRows);
dgTitles->DataSource = dvTitles;