Canvas:
Specific to Nokia's S60 devices, and possibily applicable to other Symbian devices as well: do not create multiple instances of Canvas, as it is a high-overhead object whose native implementation creates RWindow and RBackupWindow instances, which are heavyweight objects, in heap memory. Each new Canvas creates a new "RWindow" and this is know to exhaust memory pretty quickly.
I agree with previous poster that writing in big chunks is better than both saving everything at once or writing multiple small chunks. Perhaps you could also use a new Thread for I/O operations and save-as-you-go pattern. That would avoid the memory spike as well.
Images are problematic in some devices, I would only use PNG instead of JPEG, as they have smaller heap overhead.
I have a presentation about optimization for S60 devices, not exclusively for games, but it can be of some help. Contact me if you need it.
我現在的做法是即用即建,在n81和a1200上沒未出現問題。 這個問題待核實。
至于PNG比jpeg有更小的堆負擔的情況,不祥。
Specific to Nokia's S60 devices, and possibily applicable to other Symbian devices as well: do not create multiple instances of Canvas, as it is a high-overhead object whose native implementation creates RWindow and RBackupWindow instances, which are heavyweight objects, in heap memory. Each new Canvas creates a new "RWindow" and this is know to exhaust memory pretty quickly.
I agree with previous poster that writing in big chunks is better than both saving everything at once or writing multiple small chunks. Perhaps you could also use a new Thread for I/O operations and save-as-you-go pattern. That would avoid the memory spike as well.
Images are problematic in some devices, I would only use PNG instead of JPEG, as they have smaller heap overhead.
I have a presentation about optimization for S60 devices, not exclusively for games, but it can be of some help. Contact me if you need it.
我現在的做法是即用即建,在n81和a1200上沒未出現問題。 這個問題待核實。
至于PNG比jpeg有更小的堆負擔的情況,不祥。