Dublin, Ireland
+353 87 41 86 742

Memory memory everywhere, but not a drop to allocate!

Thank you beta testers! I have been able to narrow down and make progress on some key memory handling issues in the current beta release of Headlines.A new release of Headlines will be forthcoming this week! – I’ll need some help in testing the new version.

I’ve been working hard these last few days on investigating the bug reports I’ve received so far. I got some great feedback and some detailed information from some of the beta testers which has allowed me to narrow down the root cause of the errors seen for far. I’ve two ways to approach this.

The Hint
The bug reports show Headlines running out of memory when dealing with feeds with lots of images. This makes sense Headlines is a graphically intensive application. However I had a report from a user that on his phone Headlines is not actually consuming that much memory at all?! – Confusing! - This contradiction has lead me to two conclusions.

How Symbian Phone Works
When an application runs on a Symbian device the operating system creates a new process in which the application can run. A process consists of a thread (the ability to run a logical sequence of instructions) and a block of memory (RAM) for the application to use. The amount of memory the application needs to run is specified by the program. Unless you tell Symbian differently it assumes that 1 MB (Megabyte) of memory is all the application needs. To give you some context, this is less than the amount of memory on an old 3.5” floppy disk. In the background Symbian starts the program with just 4kb (less memory than an 8bit Spectrum home computer) and will provide the program with up to 1MB of RAM if the program needs it.

Conclusion 1 – Not Enough Memory
As you can probably guess I had not changes these values and so Headlines was running out of storage space for all the information being provided by the RSS Feeds it was downloading. This also explains why, when the phone was checked it looked like Headlines wasn’t actually using that much memory. Headlines had used its 1MB of memory and couldn’t get any more from the operating system, even though it was available.

Where did all the images go?
Images are handled differently to normal objects in Symbian. For speed, the raw data for an image is not actually owned by the application that creates the image. Instead the image data is actually owned and managed by a system process called the Font and Bitmap server. This means that the image data can be drawn more quickly to the screen. The down side is that there is a lot of extra memory needed to manage the image. This is house keeping information that tells the operating system who owns what image, number of colours needed, where on the screen the image is etc.

Conclusion 2 – Could be Smarter About Memory Usage
Headlines uses a lot of small images this means that a lot of memory is used by the system, just to manage each of these small images. I can save some memory by having one large image rather than lots of small ones.

Next Releases
I’m planning two future releases. The first release increases the amount of memory available to the application, upping it from 1MB. The second release will include some additional changes which will reduce the number of  images used, and hence should save some memory. Beta testers, any help in checking to ensure that these changes help the behaviour of Headlines would be brilliant!

1 Comment

  1. Anonymous

    Hi, i seem to be running into the same problem while developing my application. I'm loading a big image file which is the map to be browsed, but as my application grows, and i add more icons, it seems the maximum map image size grows smaller and smaller…
    Do you happen to know if there is a way to allocate more memory to the font and bitmap server in symbian 5th? I've been looking all over, but can't seem to find any info on that…
    Regards,
    Mark.

Leave a Reply