The ongoing software adventures of Julian Biddle

Monthly Archives: November 2008

Newcomers to Winforms and WPF .net applications are sometimes alarmed about the amount of memory they are shown to use in Task Manager.

When these applications run in a Terminal Server environment (or Citrix) the memory consumption seems to add up. I have heard of products that somehow reduce the memory consumption of processes in this environment. The makers of these products claimed to be able to fit more processes on the one server. I made it my mission to find out how these applications may work.

Minimizing as a Lifestyle

A hint as to how they may work is the behaviour of the application when it’s minimised. Memory usage definitiely goes down. When the application is normalised, memory consumption goes back up, but not as much.

For example, with a WPF application with a single window and no controls, according to Task Manager uses 27388K. On minimise of the application, memory consumption goes down to 3128K. Normalising the application, the memory consumption goes back to 8306K.

Apparently minimizing the application makes a call to the Win32 api call SetWorkingSet, this is what causes the apparent memory reduction. Looking at the history of Windows, this behaviour makes sense. In the Windows 3.1 user interface, minimizing applications was the way a user typically indicated to Windows they were switching to something else.

Something I wonder about is whether this is still appropriate? Since Windows 95 introduced the Task Switcher, do people still minimise? Another question. In the Terminal Server environment, is the call being made when a user becomes idle? Should it be?

SetWorkingSet(-1,-1)

Microsoft’s documentation of the call indicates that application calls to SetWorkingSet are not necessary, as the operating system will manage the memory as required. Is this automatic memory management assuming the Windows 3.1 usage pattern?

Two years ago I created a prototype that called SetWorkingSet when an application had become idle for a certain amount of time. It seemed to work well, but I had no evidence it helped system performance particularly.

I apologise for the inconclusive nature of this post, but I thought I would put my musing out there in case others had anything to comment.

I’m really sorry, but I don’t think Windows Mobile 6.5 or 7 is going to make any difference, it seems that Microsoft is not going to be able to produce anything compelling enough, soon enough. I don’t think there’s going to be a “comeback”.

In case you think that the iPhone is all hype and marketing, I have a question for you. Have you ever tried using one? I have yet to meet anyone who has had less than a “revelatory” experience using an iPhone.

I’ve had a great experience developing for the platform (I think the Compact Framework is excellent).

I believe the future of mobile computing is and is going to be huge, but I’m afraid Windows Mobile isn’t going to play a significant role anymore.

Future handset operating systems will be various, including of course the iPhone and Android.

Other mobile devices such as tablet computers and netbooks will probably continue to run Windows, so I think Microsoft should concentrate their efforts on continuing to ensure relevance on this form factor.

For developers I think the news is all good. There are great opportunities out their in mobility, if we are willing to “move on” in our choice of development technologies.

The presentation mainly consists of “here’s Silverlight running on Windows Mobile”. The interesting bits are at the end. I dear reader, present these to you here.

Compact Framework, small but mighty

The Compact Framework provides a great deal of rich device integration and sheer programmability. It is a pleasure to create software for. I even think that Compact Framework based applications have been a reason for customers, particularly in the Mobile Fieldworker areas to adopt Windows Mobile devices.

If you’re a Compact Framework developer like me, you may have been frustrated by the default “yesterday” appearance of the System.Windows.Forms forms engine. It takes a great deal of work to make forms look good.

Silverlight, a Framework Apart?

I for one was very excited last year at the thought of a Silverlight (ie WPF) graphics engine being available for Mobile Device development. I was then saddened to learn that the Silverlight runtime would not be extending the Compact Framework, but would exist in addition to Compact Framework.

This is disappointing news. (I am now showing my disappointed face….beware!) It appears that Microsoft (at the moment) seem determined to give Silverlight minimal access to the device. This is aligned with the idea that Silverlight is only a competitor to traditional Flash app that runs from a Web page.

Although this may be acceptable for certain kinds of desktop oriented Silverlight applications, I doubt this is a believable use case for mobile developers. The power of mobility is not only the ability to access data anywhere, but the ability to talk to the features of the device.

In the presentation mentioned at the outset, there was declaration of the intention to support Webcams, accelerometer and other device features in the future, depending on the support for this on other platforms (eg Windows and Mac).

So, we are restricted to the lowest common denominator. You may believe this is for technical reasons. It isn’t. Because….

Silverlight Uses the Compact Framework!

Amit said that the Silverlight runtime for Windows Mobile may be smaller because it may omit certain codecs and it also shares the Compact Framework Clr. He went on to say that the Compact Framework would be a prerequisite to installing the Silverlight runtime.

A new and nobler purpose for Silverlight Mobile

It’s Microsoft’s belief that targeting Windows Mobile 6.? (Sorry about that WM2003 and 5) and Nokia phones will mean Web users will eschew DHTML and Flash websites for Silverlight ones.

With the proliferation of device operating systems (particularly that pesky iPhone) I don’t think this is a likely scenario. Do you? Well do you?

I’ve I got an idea! As it’s unlikely Microsoft will backtrack on their “one platform everywhere” philosophy for Silverlight, why not, in addition enable Silverlight as a cutdown WPF for the Compact Framework on Windows Mobile? Microsoft, I know you can! Doing this would earn the gratitude of all Compact Developers and provide a side benefit to their current Silverlight efforts on Mobile.

Call to Action

If you agree, please add a comment or bookmark this article using the links below, blog about this yourself or email the people at Microsoft. Amit said they wanted feedback, lets give it!

(BTW Any physical resemblance between Amit and myself is entirely coincidental, so don’t say it)