Discussion Board

Results 1 to 2 of 2

Thread: Heap memory

  1. #1
    Registered User
    Join Date
    Jan 2004

    Heap memory

    Hello group,

    I am porting my games from other phones and encounter some heap memory problems. Can You give me some advices on how to reorganize my application to increase size of available heap memory? Where static fields are stored (storage memory or heap?) and what about memory fragmentation? Just suggest me a steps.



  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Cheshire, UK
    The heap contains classes and objects, and everything they contain - static variables belong to classes, so they're in the heap.

    Image objects are the easiest way to run out of heap. In most Nokia phones, an image takes two bytes of heap per pixel. It doesn't matter how small the png file is or how many colours are in the image, the heap requirement is always two bytes per pixel. On a Series 40 phone, a 128x128 image (screen-size) consumes 32k of memory - that's a big chunk of the 200k heap.

    If you're not doing so already, a code-obfuscator will reduce the size of your class files (classes get loaded into the heap, so this saves you heap space). The process for doing this is described in the WTK documentation.

    Nokia have a useful document in the forum entitled "Efficient MIDP Programming" that is well worth downloading.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts