Memory Slider on Windows Mobile 5.0 CE Device (not a pocket pc)

J

Jim

Hi,

I'm working with a Windows CE 5.0 device. I get "Out of memory" errors
but when I look at system memory from the control panel it shows free
program memory. However, the slider for storage and program memory is
in the white area to the right, and is not positioned in the free
program memory area. I know that WM 5.0 pocket pc devices no longer
show the slider but on this Windows CE 5.0 device ( not a pocket pc) I
do have a slider.

Also, on this device the slider does not adjust automatically as it
does on previous versions of windows CE. If there is not enough program
memory the slider does not automatically move to the left to take and
use memory from the storage memory.

So I have 3 questions:

On WM 5.0, will the OS automatically use memory from the storage area
if it runs low on program memory and will the OS automatically use
memory from the program memory if it runs low on storage memory?

Is there a setting in platform builder to turn this automatic
allocation on and off?

Since I have a memory slider control on this device and it isn't
automatically adjusting could this be causing the system to report an
erroneous "Out of memory" error?

Thanks
 
I

Ilya Tumanov [MS]

WM 5.0 no longer uses RAM for storage, instead RAM is only used as program
memory and flash is used for storage.

Thus there's no slider anymore and there's nothing to adjust - 100% of
available RAM is program memory already.



Note all devices have 32MB virtual memory limit. Even if you have plenty of
free program memory, you can run out of virtual memory.

Typical example of that would be an attempt to load "small" 4-5 MB JPEG
file. Once uncompressed, it increases 5-10-20 times, easily taking out all
available virtual memory.



Another reason for "Out of memory" exception would be not disposing of used
objects properly. Basically whatever object has Dispose() on it - needs to
be disposed off.

If you don't, these objects would not be collected and would remain in
memory forever, so you would run out of virtual memory.


--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
G

Guest

First, your post is confusing. You say WM 5.0 and you say CE 5.0 - they're
not the same. I'm going to assume you mean a CE 5.0, non Windows Mobile
device.
I'm working with a Windows CE 5.0 device. I get "Out of memory" errors
but when I look at system memory from the control panel it shows free
program memory. However, the slider for storage and program memory is
in the white area to the right, and is not positioned in the free
program memory area. I know that WM 5.0 pocket pc devices no longer
show the slider but on this Windows CE 5.0 device ( not a pocket pc) I
do have a slider.

This indicates it's a generic CE 5.0 device. You can programmatically
adjust that slider (via SystemMemoryDivision)
Also, on this device the slider does not adjust automatically as it
does on previous versions of windows CE. If there is not enough program
memory the slider does not automatically move to the left to take and
use memory from the storage memory.

Non-Pocket PC devices have never done this unless the OEM made it do it.
So I have 3 questions:

On WM 5.0, will the OS automatically use memory from the storage area
if it runs low on program memory and will the OS automatically use
memory from the program memory if it runs low on storage memory?

On a WM 5.0 device, yes. For a CE 5.0 device, generally no.
Is there a setting in platform builder to turn this automatic
allocation on and off?

No, as it doesn't exist, you can't turn it off.
Since I have a memory slider control on this device and it isn't
automatically adjusting could this be causing the system to report an
erroneous "Out of memory" error?

It's not erroneous. The system has a specific amount of RAM allocated for
use as program memory. Your app tried to alloc more than was available and
you got an exception. That's how the OS works.

-Chris
 
J

Jim

Chris


Thanks for the clarification. I did think that WM 5.0 and WIN CE 5.0
devices were the same OS.

Since they are not the same and my device is WIN CE 5.0, would it make
sense to programmatically set the slider for more program memory on
application startup? Currently the slider sits at 50%.

Also, Ilya (in a post above) memtioned that objects that dont get
disposed properly can eat-up virtual memory. Do you know of a good way
to test for this or a good tool to track down this type of problem of
objects that never get disposed?

Thanks - This helps a lot.
 
P

Paul G. Tobey [eMVP]

You can set the memory slider position in the config.bib file when you build
the OS, FSRAMPERCENT.

Not for managed code, but the Entrek TOOLBOX is a very good tool for finding
leaks in unmanaged code.

Paul T.
 
J

Jim

Chris,
Ilya,


Ilya, are you saying that objects with a Dispose method should always
have this method called; otherwise the object never gets released by
the garbage collector?

If so then would a good test to track down this problem be to keep a
running count of each instantiation of the object and each disposal of
the object then compare both running counts when the application exits?

I could create a log file entry for each constructor call and each
dispose call then check the log files to see if they match after the
application exits. Do you think this would work?

The code that I am working with is a bit odd in that it call the
GC.Collect programmatically each time a form is being drawn or
refreshed, not my design.

Thanks again
 
M

Markus Humm

Paul said:
You can set the memory slider position in the config.bib file when you build
the OS, FSRAMPERCENT.

Not for managed code, but the Entrek TOOLBOX is a very good tool for finding
leaks in unmanaged code.
Entrek will release one for managed code soon, but that can't tell you
what eats up the memory (what object types). But maybe I expect too much
out of it ;-)

Greetings

Markus
 

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