×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    May 2008
    Location
    Copenhagen, Denmark
    Posts
    84

    Smile Larger memory heap, please

    When you're making graphic-intense midlets, it's not so nice that 240x320 devices (5310 XpressMusic, 6500 classic, etc.) have the same heap size as 128x160 devices (3110 classic, 5200, etc.).

    It should be common knowledge that a higher resolution also requires more memory.

    This in effect also blocks me from caching Canvas-instances, which is correct optimization when you know the user must return to the cached screen.

    Instead there's no memory for caching, and all data needs to be loaded again - which might please the network operators, but it's certainly a costly affair for my poor users.

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: Larger memory heap, please

    Hi Steel_BRS,

    data caching can actually be achieved without caching whole Canvas instances (that will take a lot of memory, due to all the graphic data) but keeping in memory only sensitive data, avoiding the need to download it again.

    Then, if Java heap is not enough to even keep in memory this data, you can try by using RMS/FileConnection API to implement some more complex caching mechanism.

    Hope it helps,
    Pit

  3. #3
    Regular Contributor
    Join Date
    May 2008
    Location
    Copenhagen, Denmark
    Posts
    84

    Talking Re: Larger memory heap, please

    Thanks, Pit, but ...

    Quote Originally Posted by jappit View Post
    data caching can actually be achieved without caching whole Canvas instances (that will take a lot of memory, due to all the graphic data) but keeping in memory only sensitive data, avoiding the need to download it again.
    Almost all of the memory used is for the product image, I load via. HTTP, so I really don't think there's much space saving possible here.

    Quote Originally Posted by jappit View Post
    Then, if Java heap is not enough to even keep in memory this data, you can try by using RMS/FileConnection API to implement some more complex caching mechanism.
    Puh ... that sounds slow. I've previously used JSR-75 to make screenshots, and that was terribly slow - possibly even slower than loading the image via. HTTP again.

    All my Nokia handsets have 2MB heap space. All my Sony Ericsson handsets only have 1MB, but somehow they manage not to produce OutOfMemoryErrors. How can that be?

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: Larger memory heap, please

    Hi Steel_BRS,

    memory management is differently implemented from different JVM, and this could be the reason behind your OutOfMemory exceptions. Using RMS/FileConnection could be surely slow, specially for large data, but it's often the only option, if you would like to avoid extra network traffic to the user. Unfortunately, we have to live with this Java heap around

    About your image: have you tried caching only its bytes, without caching the whole Image object? Not sure it could help, but could be worth a try..

    Pit

  5. #5
    Regular Contributor
    Join Date
    May 2008
    Location
    Copenhagen, Denmark
    Posts
    84

    Wink Re: Larger memory heap, please

    Hi Pit

    Quote Originally Posted by jappit View Post
    memory management is differently implemented from different JVM, and this could be the reason behind your OutOfMemory exceptions.
    Yeah after I wrote that post yesterday, I saw that the headline shouldn't be 'Larger memory heap, please'.
    It should be 'Better utilization of memory, please' :-)

    Quote Originally Posted by jappit View Post
    About your image: have you tried caching only its bytes, without caching the whole Image object? Not sure it could help, but could be worth a try..
    Nah, if I start down this path to the dark side, I'll end up with unmaintainable code. My solution is just to catch these OutOfMemoryErrors and write 'No memory for (whatever)'.

    /Torben 'Steel' Vesterager

Similar Threads

  1. Memory Heap & OS Heap
    By earamsey in forum Mobile Java General
    Replies: 0
    Last Post: 2007-08-27, 23:02
  2. Custom heap allocator?
    By dhaas in forum Symbian
    Replies: 6
    Last Post: 2006-09-29, 03:40
  3. Heap memory
    By Vyts in forum Mobile Java General
    Replies: 1
    Last Post: 2004-01-18, 11:52
  4. Replies: 2
    Last Post: 2004-01-08, 18:36
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

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