From: Rohit on
I am developing a simple application for the .NET compact framework 2.0. My
ipaq device has 64 MB total memory and about 16 MB of available memory for
the app. The app does the following:

1. connects to a remote web service and gets the data in several database
tables back in a DataSet
2. displays some data (on request) in a datagrid control

I found that this simple app using 9 MB of memory *after* the operations are
completed. If I attempt to do anything more complicated, Windows Mobile
gives me a message saying that available memory is too low and wants me to
start closing other running apps.

This is a mess. Why is .NET such a memory hog? Are there ways to code my
app to minimize its memory utilization?

The way I see it, I have 2 options:

1. increase the amount of memory in my ipaq device
2. keep the memory at 64 MB and port my app to MFC which is more memory
efficient

What would you guys recommend?

I am trying to resist moving away from .NET because it's easy to write
applications using it.

From: " ctacke/>" on
Without knowing more it's hard to say, but my guess is that your use of
DataSets is the problem. .NET isn't inherently a memory hog, but if you
load a DataSet, then all the data in it is in RAM, so if you load up a
couple large DataSets, then obviously it's going to take up a lot of RAM.
Either filter the data or use a different data access mechanism like a
ResultSet.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com


"Rohit" <Rohit(a)discussions.microsoft.com> wrote in message
news:AEBA1DE0-8676-4354-A3AC-2755AFC47C33(a)microsoft.com...
>I am developing a simple application for the .NET compact framework 2.0.
>My
> ipaq device has 64 MB total memory and about 16 MB of available memory for
> the app. The app does the following:
>
> 1. connects to a remote web service and gets the data in several database
> tables back in a DataSet
> 2. displays some data (on request) in a datagrid control
>
> I found that this simple app using 9 MB of memory *after* the operations
> are
> completed. If I attempt to do anything more complicated, Windows Mobile
> gives me a message saying that available memory is too low and wants me to
> start closing other running apps.
>
> This is a mess. Why is .NET such a memory hog? Are there ways to code my
> app to minimize its memory utilization?
>
> The way I see it, I have 2 options:
>
> 1. increase the amount of memory in my ipaq device
> 2. keep the memory at 64 MB and port my app to MFC which is more memory
> efficient
>
> What would you guys recommend?
>
> I am trying to resist moving away from .NET because it's easy to write
> applications using it.
>


From: Rohit on
Well, won't each dataset be cleaned up by the GC after I place all the data
in it into my local database, i.e. when the dataset is no longer needed?

The 9 MB of memory is used after all the db operations are done and the app
is just sitting there idle. Only when I close the app does the 9 MB get
returned to the ipaq device.

Is there any way to tell how much memory my application is using in Windows
Mobile and also how much memory the .NET compact framework is using?

"<ctacke/>" wrote:

> Without knowing more it's hard to say, but my guess is that your use of
> DataSets is the problem. .NET isn't inherently a memory hog, but if you
> load a DataSet, then all the data in it is in RAM, so if you load up a
> couple large DataSets, then obviously it's going to take up a lot of RAM.
> Either filter the data or use a different data access mechanism like a
> ResultSet.
>
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Giving back to the embedded community
> http://community.OpenNETCF.com
>
>
> "Rohit" <Rohit(a)discussions.microsoft.com> wrote in message
> news:AEBA1DE0-8676-4354-A3AC-2755AFC47C33(a)microsoft.com...
> >I am developing a simple application for the .NET compact framework 2.0.
> >My
> > ipaq device has 64 MB total memory and about 16 MB of available memory for
> > the app. The app does the following:
> >
> > 1. connects to a remote web service and gets the data in several database
> > tables back in a DataSet
> > 2. displays some data (on request) in a datagrid control
> >
> > I found that this simple app using 9 MB of memory *after* the operations
> > are
> > completed. If I attempt to do anything more complicated, Windows Mobile
> > gives me a message saying that available memory is too low and wants me to
> > start closing other running apps.
> >
> > This is a mess. Why is .NET such a memory hog? Are there ways to code my
> > app to minimize its memory utilization?
> >
> > The way I see it, I have 2 options:
> >
> > 1. increase the amount of memory in my ipaq device
> > 2. keep the memory at 64 MB and port my app to MFC which is more memory
> > efficient
> >
> > What would you guys recommend?
> >
> > I am trying to resist moving away from .NET because it's easy to write
> > applications using it.
> >
>
>
>
From: " ctacke/>" on
It would get cleaned up only if all references are gone and a GC occurs.
The usage you're seeing clearly indicates to me that you've not released all
references, so the GC is keeping the DataSets around.

RPM and the Managed Call Profiler would be useful tools.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


"Rohit" <Rohit(a)discussions.microsoft.com> wrote in message
news:626640FC-5B8D-4283-A187-A550B087E3EB(a)microsoft.com...
> Well, won't each dataset be cleaned up by the GC after I place all the
> data
> in it into my local database, i.e. when the dataset is no longer needed?
>
> The 9 MB of memory is used after all the db operations are done and the
> app
> is just sitting there idle. Only when I close the app does the 9 MB get
> returned to the ipaq device.
>
> Is there any way to tell how much memory my application is using in
> Windows
> Mobile and also how much memory the .NET compact framework is using?
>
> "<ctacke/>" wrote:
>
>> Without knowing more it's hard to say, but my guess is that your use of
>> DataSets is the problem. .NET isn't inherently a memory hog, but if you
>> load a DataSet, then all the data in it is in RAM, so if you load up a
>> couple large DataSets, then obviously it's going to take up a lot of RAM.
>> Either filter the data or use a different data access mechanism like a
>> ResultSet.
>>
>>
>> --
>>
>> Chris Tacke, Embedded MVP
>> OpenNETCF Consulting
>> Giving back to the embedded community
>> http://community.OpenNETCF.com
>>
>>
>> "Rohit" <Rohit(a)discussions.microsoft.com> wrote in message
>> news:AEBA1DE0-8676-4354-A3AC-2755AFC47C33(a)microsoft.com...
>> >I am developing a simple application for the .NET compact framework 2.0.
>> >My
>> > ipaq device has 64 MB total memory and about 16 MB of available memory
>> > for
>> > the app. The app does the following:
>> >
>> > 1. connects to a remote web service and gets the data in several
>> > database
>> > tables back in a DataSet
>> > 2. displays some data (on request) in a datagrid control
>> >
>> > I found that this simple app using 9 MB of memory *after* the
>> > operations
>> > are
>> > completed. If I attempt to do anything more complicated, Windows
>> > Mobile
>> > gives me a message saying that available memory is too low and wants me
>> > to
>> > start closing other running apps.
>> >
>> > This is a mess. Why is .NET such a memory hog? Are there ways to code
>> > my
>> > app to minimize its memory utilization?
>> >
>> > The way I see it, I have 2 options:
>> >
>> > 1. increase the amount of memory in my ipaq device
>> > 2. keep the memory at 64 MB and port my app to MFC which is more memory
>> > efficient
>> >
>> > What would you guys recommend?
>> >
>> > I am trying to resist moving away from .NET because it's easy to write
>> > applications using it.
>> >
>>
>>
>>