D
David Brunning
Not sure, but I believe that the compact framework SP3 leaks memory
when using PInvoke on Windows Mobile 2003 Second Edition.
I have two applications - the first is a framework application that
updates a SQLCE database using DataSets and DataAdapters. The
database is synchronised with a central database using CE Merge
Replication and I initially thought that I had to populate the rowguid
column myself on the device so there is a PInvoke call to
CryptAcquireContext in order to build a Guid (There is an article on
MSDN on how to here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/PPCGuidGen.asp).
The second application was written when the first seemed to be leaking
memory and is a memory profiler which PInvokes to GlobalMemoryStatus
to log memory usage on the device over time (Another article on MSDN
here http://msdn.microsoft.com/smartclient/community/cffaq/cf10.aspx#cfw0ezz1
under "Device Capabilities and Capacity").
Running app 1 results in an out of memory exception in the PocketGuid
class and logging memory usage with the profiler clearly shows memory
load increasing at an alarming rate (Goes up 40% in about 10 minutes)
I wondered if the profiler was the problem so ran that with nothing
else on the device to baseline memory usage over 10 minutes and adjust
the memory profile of app 1 accordingly - it was clearly not although
the profiler app did seem to contribute to the problem.
So, I removed the guid generation from app 1 and reprofiled - memory
usage now doesn't appear to go up anywhere near as much - the only
leak now is from the profiling application which makes a PInvoke call
itself.
The profiling application source code is available for download here:
http://exc01.ccsit.co.uk/davidbrunning/Memory/MobileProfiler.zip
To reiterate - this problem appears to be limited to Windows Mobile
2003 Second Edition (4.21.1088) - with an older IPAQ running Pocket PC
2003 (4.20.1081) the problem doesn't seem to occur - or at least
occurs less obviously.
Could someone try this on a WM2003SE device (Mine is an hp iPAQ hx2110
which uses an Intel PXA270) and tell me if I'm wrong?
This is something which is on the release note for .NET CF SP3 as
being fixed - but I'm not sure it has.
Thanks
when using PInvoke on Windows Mobile 2003 Second Edition.
I have two applications - the first is a framework application that
updates a SQLCE database using DataSets and DataAdapters. The
database is synchronised with a central database using CE Merge
Replication and I initially thought that I had to populate the rowguid
column myself on the device so there is a PInvoke call to
CryptAcquireContext in order to build a Guid (There is an article on
MSDN on how to here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/PPCGuidGen.asp).
The second application was written when the first seemed to be leaking
memory and is a memory profiler which PInvokes to GlobalMemoryStatus
to log memory usage on the device over time (Another article on MSDN
here http://msdn.microsoft.com/smartclient/community/cffaq/cf10.aspx#cfw0ezz1
under "Device Capabilities and Capacity").
Running app 1 results in an out of memory exception in the PocketGuid
class and logging memory usage with the profiler clearly shows memory
load increasing at an alarming rate (Goes up 40% in about 10 minutes)
I wondered if the profiler was the problem so ran that with nothing
else on the device to baseline memory usage over 10 minutes and adjust
the memory profile of app 1 accordingly - it was clearly not although
the profiler app did seem to contribute to the problem.
So, I removed the guid generation from app 1 and reprofiled - memory
usage now doesn't appear to go up anywhere near as much - the only
leak now is from the profiling application which makes a PInvoke call
itself.
The profiling application source code is available for download here:
http://exc01.ccsit.co.uk/davidbrunning/Memory/MobileProfiler.zip
To reiterate - this problem appears to be limited to Windows Mobile
2003 Second Edition (4.21.1088) - with an older IPAQ running Pocket PC
2003 (4.20.1081) the problem doesn't seem to occur - or at least
occurs less obviously.
Could someone try this on a WM2003SE device (Mine is an hp iPAQ hx2110
which uses an Intel PXA270) and tell me if I'm wrong?
This is something which is on the release note for .NET CF SP3 as
being fixed - but I'm not sure it has.
Thanks