Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003

    Text in resources to save heap use

    I need to reduce my heap memory use, so I thought I could move some text I don't need very often to a resource and load it in when I need to use it.
    How can I put the text in a resource file in a format that I can read it out in my midlet ?
    without writing a midlet to do it which is too much hassle.
    Does anyone have any other tips for reducing heap usage ?


  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Cheshire, UK
    There's a discussion on using text-resource files (with a focus on localization) at http://discussion.forum.nokia.com/fo...threadid=29350.

    My one tip for optimizing memory usage would be to know how much memory everthing is taking. This is especially true if you are a recovering C programmer, because Java looks deceptively like C, but things that are memory-efficient in C can be very costly in Java (that is, things that might look very similar in both languages). (I'm thinking mainly of arrays, Strings and array-initializers.) Also, if you're big on object-orientation, you may need to unlearn it. It has a tendancy to be costly on both memory and performance.

    The memory foot-print of Image objects is another thing to be aware of if you aren't already. No matter how small you get that PNG file, the loaded Image will need 2 bytes per pixel on most Nokia phones (plus a few odd bytes). (And this is not unique to Nokia.)


Posting Permissions

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