Memory limit reached with Windows Mobile
- From: "Patrick A." <patrick.avenel@xxxxxxxxx>
- Date: 26 Feb 2007 00:51:38 -0800
Hello,
We are currently having memory issues with our Pocket PC application.
We are using PsionTeklogix WorkAbout Pro devices with Windows Mobile
2003 and the Compact Framework 1.0 SP3.
The device has 95.80 Mb of RAM, 30 Mb of ROM and a 512 Mb SD-Card.
Most of our application is loaded directly from the SD-Card.
The limitations we have experienced are the following:
- 25 Mb per process
- 12 Mb for the DLLs (independently from the number of
processes)
- DLLs can only be loaded in the "first" 12 Mb of each
process
For example:
1. If a process loads 4 Mb of DLLs, then 8 Mb of data, he can no
longer load DLLs, but can still load data. A second process launched
in parallel will be able to load a maximum 8 Mb of new DLLs, then
data.
2. If a process loads 12 Mb of data, it can no longer load a single
DLL.
What happens in our application is that at some point we reach the 12
Mb limit and every attempt at loading a library after that fails.
Such behaviour is described here: http://msdn2.microsoft.com/en-us/library/ms836325.aspx
"Now consider what to do if you encounter a potential problem.
Suppose
Process 2 loaded DLL C that was quite large as shown in Figure 6.
Note
that process 3 has the bad luck of being both a large .exe file and
loading a DLL after process 2 had loaded its rather immense DLL C.
Clearly, process 3 is close to trouble if it attempted to load any
more DLLs that had not been loaded already by other processes. This
is
a somewhat contrived example because the size of DLL C would have to
be incredibly large, or Process 2 would have to load a large number
of
DLLs for this problem to occur naturally."
We do have a large number of DLLs, some of which are quite large and
the previous example is no longer contrived in our case.
To avoid the problem, we tried several approaches:
- Free some memory in the critical 12 Mb area when we need to load
a new DLL
o The compact framework doesn't seem to free the memory for
native DLLs, but only for its own future use.
o We tried to artificially create 12 Mb of data before
loading our real data, and then free the 12 Mb of artificial data to
restore some free memory in the critical memory space, but no new DLL
could be loaded afterwards.
o We even tried to broadcast a WM_HIBERNATE message to
force the Compact Framework to free some memory, but in vain.
- Migrate our application to Windows Mobile 2005 and the Compact
Framework 2.0
o We had the same memory issues.
- Split our application in several processes.
o We still reach the 12 Mb limit for the DLLs, no matter
how many processes are involved.
o Loading our DLLs in a separate process doesn't change
the
behaviour.
- Load all our DLLs before loading data.
o This approach has been quite successful so far.
o We still have some issues with several functionalities
such as HTTPS WebService calls, which fail if the very first call is
made when the memory has already passed the 12 Mb limit:
"System.Net.WebException - Could not establish secure channel for
SSL/
TLS".
Is there something to pre-load so that our HTTPS call will already
have its requirements loaded before the memory has passed the 12 Mb
limit?
Did we miss something in our understanding of how memory is managed
in
Windows Mobile 2003?
Our application requires more than 12 Mb of memory (most of which is
data and C# .Net libraries), and needs to be able to load new DLLs at
all time, what would
you recommend in this situation?
Thank you in advance,
Sincerely,
--
Patrick AVENEL
.
- Follow-Ups:
- Re: Memory limit reached with Windows Mobile
- From: <ctacke/>
- Re: Memory limit reached with Windows Mobile
- Prev by Date: Re: Running Processes List
- Next by Date: Has anybody created a custom Directshow filter on windows mobile 5.0 PPC?
- Previous by thread: Running Processes List
- Next by thread: Re: Memory limit reached with Windows Mobile
- Index(es):
Relevant Pages
|
Loading