R
RobRasti
I'm trying to support some issues with some older code written in
VB.Net for Compact Framework 1.1. The problem I'm having is when a
form is opened the application consumes some amount of memory. When
the form is disposed the memory is never reclaimed.
Upon further research the code was using PictureBox controls instead
of buttons, and I found the image objects being used were not being
disposed properly. However there still appears to be a spike in
memory use when using a SQLCE DataAdapter to fill a DataTable and then
use that DataTable as a datasource for a DataGrid. The basic code is
as follows:
User Taps "Search" button on screen.
- Build SQL command string based on some criteria the user enters.
- Instantiate the DataAdapter
- Call the Fill method
- Set the DataSource of the DataGrid
- Dispose of the SelectCommand object of the DataAdapter
- Dispose of the DataAdapter object
When the form closes I've overridden the Dispose method and I dispose
of all onscreen controls and in the case of the datagrid I dispose the
DataSource property and set it to Nothing, then dispose the datagrid
itself.
Is there something I am missing? It seems as though the application
is hanging onto the data it pulls from the database and displays via
the datagrid. I am explicitly calling the Dispose method of the form
and have some internal application logging that proves it is being
called when the form is closed. However I still can't seem to find
where this memory is being consumed and not released.
Rewriting this code or recompiling it for a later version of the
compact framework is not an option as my client has roughly a couple
thousand handheld computers with this application deployed and are not
looking to perform a massive upgrade that it would take to update the
compact framework.
Thanks for your help.
-R-
VB.Net for Compact Framework 1.1. The problem I'm having is when a
form is opened the application consumes some amount of memory. When
the form is disposed the memory is never reclaimed.
Upon further research the code was using PictureBox controls instead
of buttons, and I found the image objects being used were not being
disposed properly. However there still appears to be a spike in
memory use when using a SQLCE DataAdapter to fill a DataTable and then
use that DataTable as a datasource for a DataGrid. The basic code is
as follows:
User Taps "Search" button on screen.
- Build SQL command string based on some criteria the user enters.
- Instantiate the DataAdapter
- Call the Fill method
- Set the DataSource of the DataGrid
- Dispose of the SelectCommand object of the DataAdapter
- Dispose of the DataAdapter object
When the form closes I've overridden the Dispose method and I dispose
of all onscreen controls and in the case of the datagrid I dispose the
DataSource property and set it to Nothing, then dispose the datagrid
itself.
Is there something I am missing? It seems as though the application
is hanging onto the data it pulls from the database and displays via
the datagrid. I am explicitly calling the Dispose method of the form
and have some internal application logging that proves it is being
called when the form is closed. However I still can't seem to find
where this memory is being consumed and not released.
Rewriting this code or recompiling it for a later version of the
compact framework is not an option as my client has roughly a couple
thousand handheld computers with this application deployed and are not
looking to perform a massive upgrade that it would take to update the
compact framework.
Thanks for your help.
-R-