RAM Optimizations

  • Thread starter Thread starter info
  • Start date Start date
I

info

Hi there

I need any aviable hint on how to reduce ramusage in CF 2
applications.


On Mobile 5 there is only about 15 - 25 MB of RAM aviable for user
applications, which is , if you have a big database app, really awfull.

On the GC I read an article and I'm a little confused on the handling.
Here in detail:

MyObject loTest = new MyObject();

loTest.DoSomeWork();
loTest.Dispose() // This is necessary to save RAM isn't it ?
loTest = null // May now the Garbage collection find loTest anymore to
cleanup because I haven't any more any reference ? Or do I have to not
set it to null??

An other question:
Do I have to dispose all elements (like textboxes , labels and so on)
on a form in the forms dispose or close event? Or does the it by
itself?

Hope someone may help me
Thank you all very much!
 
The amount of available RAM will vary between devices and
configuration, tho there is/was a 32MB process space limit in PPC2003,
not sure if this still applies to WM5, guess it does. There is no such
limit on storage space, don't get the two confused.

Having 25MB of program space is huge, if not then you should look at
your coding to make it more efficient in areas, particularly when
handling large datasets.

Are you actually running out of memory? It is a common misconception by
developers new to PPC/WM that they expect to see instant changes in
memory when objects are free'd. This is not the way the GC operates,
there are plenty of threads on more detailed info, but basically, leave
it alone and it will clear up when it sees fit.

The Dispose() method need only be called if your object implements it,
and it need only do that if it needs to clear up any objects which it
uses internally.

You should not need to dispose of regular GUI controls.

Having said all that, there are some know 'memory leaks' mainly in
databound controls in PPC2003, search the ng for more info.

Chris
 
Thanks for replay.
Currently on WinCe devices its absolutly no problem.
on WM 5 in worst cases only 15 MB RAM are left.

the thing that memory does not instantly clear up is a point. But how
may I now check the Memory amount my application needed`?

The mainproblem is that I need to show some lists with about 100 - 200
Records. from One list I navigate to an other and back again and I
don't want to reload it everytime the active form changes due to
performance reasons.
So In worst case there are 3 forms opened with each of them having 200
Records with 10 Fields...

In some tests a remoteControl said that my Application uses 20 -25 MB
RAM and that seems to be not su much space.
What about Datasets / DataTables which I needed to show some data,
should I call there the dispose method ?
And should I set them null ?

I 've got some method which return data as a DataTable which is the
nassigned to the Controls to show them
Is there a more efficient way to do this ?

Thank you!
 
Are all the forms showing the same 100-200 records? If so create a global
dataset that you can then use in your form. One set of records used by all.

Robert Brown
 
Hi
thanks for the postings

The records are all different so different data. (Adresses, Users,
messages,....)
 
Back
Top