Forms And Memory

  • Thread starter Thread starter MDB
  • Start date Start date
M

MDB

Hello All, I have a question about forms and memory. I used to always leave
my forms in memory and then load them when needed however, due to becoming
tight on memory, I started to close my forms and then create new ones when
needed. My question is, what is better, leaving them open or disposing of
them? I started getting out of memory errors recently however, I am unsure
if it is because of this or switching to CF2.0 (did both at the same time).
 
There is no blanket "better" evaluation. Keeping htme in memory means they
load faster for subsequent use, but take up space in the GC heap in order to
do so. It's a trade-off and only you can know what fits your application
usage scenario.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
Hello All, I have a question about forms and memory. I used to always leave
my forms in memory and then load them when needed however, due to becoming
tight on memory, I started to close my forms and then create new ones when
needed. My question is, what is better, leaving them open or disposing of
them? I started getting out of memory errors recently however, I am unsure
if it is because of this or switching to CF2.0 (did both at the same time).

As Chris pointed out, it depends on your situation AND the target
device.
For example, if you're targetting WM5 devices, then you'll have less
memory resource than the WM6 devices. So, with WM6 devices, you can
have more forms in memory than the WM5 devices. I have a project
involving only WM6+ devices, so I'm able to keep quite a bit in memory
(i.e. 10+ forms, 15 resultsets, etc.). Given the time required to
create new forms, it will be better to have it open in memory if at
all possible.

- Jin
 
Back
Top