×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    21

    Why createImage(x, y) takes so small memory?

    Hi 2 all!

    I made test, where creating mutable image:

    img = Image.createImage(392, 392)

    and making some scroll of that image (30 seconds for stable result) and min/max memory usage count in this time

    Memory taken buy image very small!!! :

    (runtime.totalMemory()-runtime.freeMemory()) ~ 28kb

    WHY? I know that memory values (by runtime) not true, but difference between them near true value

    392x392=153664 (only in 1 byte on color!) - it's more than 28Kb!
    And 28Kb takes all midlet (created mutable image, loaded png tileset for fill image, midlet code)

    So, maybe memory compressed or something else?

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    Which device? Some devices will allocate space for images outside the Java heap, using some native operating system resource, so the image does take memory, but the memory does not appear in the Java memory figures.

    Graham.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    21
    Tested on S60 (N-Gage, 7650, etc)...
    I want to know: on Series 40 where jar limit 64k & mem limit 200k - can I create so big images (more 200k what avalibale from java) or 200k limit - it's total phone limit?

    I can attach test and any who want can past results

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    The N-Gage, like other Series 60 devices, has a dynamic heap. The machines have up to several megs of memory, but not all of it is allocated to the JVM on startup. If the JVM needs more memory then more memory is allocated. This means that the memory monitoring can return strange effects where using a lot of memory can actually give you even more free memory than before, because you used all the available memory and the JVM asked the system for more.

    shmoove

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    21
    A agree with you BUT:
    If we use runtime.totalMemory() - that value CAN dynamicaly changes.
    And for exaple, on start aplication (when only midlet and some classes created) we can have 68Kb of memory,
    but when we loaded resources we can have more - 384Kb total. And when we loaded level with more data than previews - we can got total 1Mb.

    So runtime.totalMemory() returns NOT constant value for midlet lifecycle...

Posting Permissions

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