| Reply | « Previous Thread | Next Thread » |
|
I am having troubles with heap memory on Series40, so I begin to evaluate some tests.
I wrote a simple midlet with a canvas class. It paints freeMemory and totalMemory on screen. That is all. Jar size is: 1.87KB Midlet.class : 823 Bytes MyCanvas.class : 1433 Bytes There is only one "new" in midlet to create a MyCanvas instance, and MyCanvas has only one member for holding a reference back to the midlet. When I run the application on a Series40 phone (specifically it is a 3200 I think, I am lost in all those numbers), it displays: FreeMemory: 188148 TotalMemory: 215040 Total Memory is consistent with the specified figure of 210K. However I dont understand the reason why free memory is 188148. I almost allocate nothing. Where does 27K go ? Is it for JVM or some internals ? Will I always start with a heap around 190K ? Thanks in advance. MB |
|
My observations:
Same midlet (big, ~64Kb jar, many graphics) takes different memory on phones and emulators to(! they show realy memory on that phones): SE T6xx: 170Kb Samsung C100: 275Kb Nokia S40 (7210, 6100): ~350Kb All values on emulators and devices, exclude S40, because it's not fit in to memory, so only emulator + real device but with cut data for check So, S40 devices (and may be other series?) uses memory VERY not efficiently. Best results on SE. We can build MORE BETTER game, for example, on that device not look at 256Kb heap limit (in realy used only 180Kb)! But that game can't be run on S40 at all. And if remember about better jar limits on SE... Nokia, what happens? May be better use some special techniks for save memory? |
|
With the SE phone you have to take into account that it has 80KB of video memory to load images into. That could easily explain the big difference.
And in reply to both posts: remember that the KVM will also consume memory for it's methods. With a Canvas a call to paint() needs a Graphics context, the lifecycle methods in the MIDlet class probably create a few objects for their own use, etc. Another thing that might cause differences between phones is the format they use to store their images. I am not that familiar with the Samsung C100 though, how many colors does the screen have. shmoove |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|