[P3400 ROM Development] krazy_about_technology:
:D Thanks buddy. You are right about the "rush". There are issues nobody is caring about but me and duron have been working on these for a lot of time and have finally arrived at the decision to use the WM 6.1 21055 build on our gene and prepare for a new phone. WM 6.5 isn't going to get any better than what its presently is, as far as ram usage is concerned, i can say this from the past record of 6.1 and the Virtual Memory architecture used in WinMo.

After days of working over different issues we found out that most of the problems we were facing were due to a few OEM files that we were using from different phones, in order to keep up with the "latest" but in fact, these files were very much device specific. So the rom i am using right now has most OEM utilities, like the control panel applets for power, microphone agc, network etc are from original gene ROM and a few system services that are directly connected to the Radio Interface Layer (RIL) like STK_Service.dll and USSD_Service.dll are also from gene original rom. I am even using the old audio manager and audio booster. The old one has a volume control independent of the system volume (of course it doesn't show album art but who cares!) which is very handy as the system volume goes up and down in very large chunks, so either u get very high volume or very low, something i dont prefer for listening to my music library. Nitrogen is a good one, but it fails to play some of my mp3s.

Apart from this, we are also using a carefully drafted, well tested pattern for recmodding files in the rom since it affects free Virtual Memory as well as system perfomance. I have digged into over 200 system dlls to find this optimum solution.

The result of all this is that i now have a fabulous rom that runs for upto 2.5 weeks without a single restart and a good battery life of 2 days (from my 1.5 years old, heavily used battery). I had not faced any crashes or freezes of mobile since last month, its almost as good as a stock rom.

I am gonna post all this stuff soon, i am currently a bit occupied in interviews and all so there is no time, but will do it in steps soon.

For you first problem, lemme give u a quick summary. On Windows Mobile, the free memory we see is actually less than what is specified on the device box because of some memory being pre-occupied by system stuff. First of all, there is pagepool. If you are using a pagepool of 8 MB, you have 64-8 MB =56 MB. From this 56 MB, around 4 MB is used as video memory so 56-4=52. Out of this 52, about 5 MB is reserved for static system dlls and drivers. This is done because on WinMo, only 32 MB of addressable memory is available for a running program at most (for details read the link i gave to u). And the dll loading procedure of Windows CE 5.x is such that the dll loading space is shared between apps. So if one application loads DLL A at an address say 100 of size 100 bytes then if the other application needs to load a DLL B, it will have to do at address >=200 even when it is a seprate process. In this structure, the upper 100 bytes of all process launched futher will be kept reserved for loading DLL A, if they ever load it.

Now if u understand this, u know that if we have everything from the OS running in our VM space, it will be filled even before we could start. So a lot of stuff that is needed contineously for running the basic system is kept above the VM area.

So u get 47 MB of free mem with a 64 MB system and page pool of 8 MB. Now out of this 47, some gets used by the camera driver for its buffer. It depends on the megapixel count of camera. A 2 MP camera takes 4 MB for buffer. The camera loader utility recovers this space but that is also not a good practice. This is because, camera is used spontaneously and if it needs to load a 4 MB dll every time, at a point VM space may not allow that. This is what happens on 6.5 when u get an error while starting camera when u use camera loader. 6.5 has a way lot of dlls and our gene's kernel is not compiled against the 6.5 source code so that it can use the additional virtual memory it provides in its new model. So we are stuck with 6.0 memory model and have to fix everything in it. Its far too crampy and eventually makes the mobile useless for a user like me. I have to restart my mobile everyday with 6.5 due to VM space full issues and the extra battery life we get with 6.5 is of no use. Restarting itself takes a lot of battery, so whats the point.

On my 6.1 ROM, i keep all my apps running and at a time, i have 10-14 apps running simultaneously all the time. It takes less toll on the battery too, since restarting applications every time causes the phone to read it from phones flash memory, and if you know about the physical structure of flash memory, you would know that it consumes a lot of power. memory cards are even worst than phone memory in this respect. SO the more u close and open apps, more battery u consume.

I hope this will solve many of your queries. :D :) Enjoy!