Steve O'Keefe
Steve O'Keefe

Reputation:

Windows Mobile Memory Leak Issue

All,

I currently have a phone from a customer who experienced various issue while running our windows mobile application. This issue is that the phone eventually resets completely while running the application. I have this in house to do some testing and I haven't experienced the reset, but I do notice that program memory is dropping significantly while running through the forms. We do have a slight memory leak in out application that we have been trying to narrow down, but nothing to this magnitude.

Eventually the application just drops out of program memory, but it seems as though not all the memory is released. Program memory doesn't go back up to what it was originally. They have installed some third party applications, such as VicSoft ClearTemp, but this applications seems to just remove temporary files to keep the storage memory low. The phones in question are Sprint 6800 Windows Mobile 6.0 profressional. The application is written in the .NET 2.0 Compact Framework.

We do have an issue where the application is dropping out of memory which is still an ongoing issue, and this seems to be happening randomly. THis issue seems to be directly memory related, but maybe the two are working hand in hand causing the crash.

Any ideas or help would be greatly appreciated.

Upvotes: 2

Views: 2075

Answers (5)

ctacke
ctacke

Reputation: 67178

The effect of the app ending is likely being caused by 1 of 2 things:

  1. An unhandled exception (likely an OOM) is causing it to unwind. You should be handling these.
  2. The WinMo platform itself is killing the app via the WM_HIBERNATE message.

As has been pointed out, ensure you are calling Dispose on all GDI-related objects (Bitmaps, Pens, etc). Descriptions of a bug related to Bitmaps can be found here and here.

Another thing to be aware of is that Components on a Form are not Disposed when the Form itself is (unlike Controls, which are). So if you're doing a lot of Form creating and destruction, pay close attention to that.

If you can upgrade the project to target 3.5, even if it's only for internal testing, running the CF 3.5 CLR Profiler can certainly help you find the leak.

Upvotes: 3

harry lei
harry lei

Reputation: 11

if its a memory leak then the result program grabs more and more memory until it finally crashed due to short of memory. It means dynamically memory are created or allocated but forget to unreleased the memory. If memory leak happen then unreachable memory for your given program. for this particular solution you can also see this.

Upvotes: 0

Ronen
Ronen

Reputation: 1

Great solution to Windows Mobile Memory Leak - cleanRAM (RAM Cleaner).

Get more information and download the latest cleanRAM version:

www.htcaddicts.com/?id=110

Upvotes: 0

Quibblesome
Quibblesome

Reputation: 25409

If you're constantly creating and destroying objects ENSURE your event handlers are unhooked, otherwise the Garbage Collector will think these objects are still in use, resulting in what looks like a memory leak.

Upvotes: 0

MusiGenesis
MusiGenesis

Reputation: 75296

Make sure you're disposing your forms after you're done with them (calling Dispose() or declaring and using them in a using() block), especially if they contain Bitmaps and/or PictureBoxes. More generally, make sure you're disposing every resource that can be disposed of.

Upvotes: 3

Related Questions