Reputation: 13266
I'm supporting a Windows Mobile 6 .Net compact framework forms-based application. We have reached a point now where the amount of data being used in the application is causing out of memory errors. While the application has a limited life expectancy I would like to feel confident that it will continue to perform adequately until a replacement platform/application is developed. The amount of data being used in the application isn't getting smaller so one option is to reduce the size of the application code.
Some time ago I stumbled on a blog post or document that I recall indicated one approach to minimising the memory occupied by application code was to move all source into separate assemblies and start the application using a small startup shell. Before starting work on that approach I want to confirm that is the correct approach and quantify the savings that might be achieved by doing that.
Is the above approach correct and if so, is there documentation to support it?
Upvotes: 1
Views: 1016
Reputation: 2039
The approach you describe of placing all of your application code into a managed dll and creating a very small executable stub to launch does decrease the amount of memory required by the process. The amount of memory you'll save is equivalent to the size of your executable aligned to the next highest 64Kb boundary.
See this blog entry for more information: http://blogs.msdn.com/b/robtiffany/archive/2009/04/09/memmaker-for-the-net-compact-framework.aspx
That blog entry also has links to more detailed explanations of WinCE 5's memory management system and why the dreaded "dll crunch" is such a big problem.
However, be aware that since the introduction of Windows Mobile 6.1, things have changed a bit. Native Dlls are no longer mapped to the same place as they were in previous versions, leaving your process with much more memory space to operate. You mentioned Windows Mobile 6 in your question, so be aware than while this suggested refactor will indeed grant you more memory to work with, it may not give you enough (unless your .exe is huge).
See here for more information on the memory management changes introduced in Windows Mobile 6.1:
http://bolingconsulting.com/2008/windows-mobile-6-1-memory-management-changes/
Upvotes: 3
Reputation:
I ran into this "out of memory" problem once. I had to create a special class to hold my data that did not include as much information as the classes used by my PC applications.
I've never seen the document you reference about using a small startup shell script other than things I've read in using MS-DOS.
Upvotes: 0