Forms And Memory

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).
 
C

Chris Tacke, eMVP

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
 
J

Jin Chang

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top