J2ME, continusly load image, low speed....

Discussion in 'Java' started by Boki, Oct 24, 2005.

  1. Boki

    Boki Guest

    Hi All,
    It seems that speed will become slower and slower after a while.

    Could you please advice?
    The image A / B are both 5KB size jpg file.

    Best regards,
    Boki.

    ====================
    public void run()
    {

    int hhhhh=0;
    lastSendTime=System.currentTimeMillis() ;
    //////////////////////////////
    while(got_ate0<100)
    {


    if (System.currentTimeMillis() - lastSendTime > 120)
    {
    lastSendTime=System.currentTimeMillis() ;


    hhhhh=1-hhhhh;

    try {
    if (hhhhh==0)
    GUI.aaimage = Image.createImage("/2.jpg");
    else
    GUI.aaimage = Image.createImage("/1.jpg");

    }
    catch (Exception e)
    {
    }
    got_ate0++;
    gui.repaint();

    }
    }
     
    Boki, Oct 24, 2005
    #1
    1. Advertising

  2. Boki wrote:

    > Could you please advice?


    My advice is 'post compilable code'.

    > The image A / B are both 5KB size jpg file.


    Have you ruled out 'image caching'?
    Check the freeMemory/totalMemory* each iteration.

    * Yes, yes. Listed in the JavaDocs.
     
    Andrew Thompson, Oct 24, 2005
    #2
    1. Advertising

  3. David N. Welton, Oct 24, 2005
    #3
  4. Boki

    Boki Guest

    I don't know how to check

    " freeMemory/totalMemory* each iteration"

    ..... I am using Sony Ericsson WTK toolbar / Netbeans 4.1/5.0

    Why I do this is to simulate when I got a lot of jpg file ( from
    Bluetooth ), can I decode/render in screen on time....


    Best regards,
    Boki.


    "Andrew Thompson" <>
    ???????:Vr67f.26577$...
    > Boki wrote:
    >
    >> Could you please advice?

    >
    > My advice is 'post compilable code'.
    >
    >> The image A / B are both 5KB size jpg file.

    >
    > Have you ruled out 'image caching'?
    > Check the freeMemory/totalMemory* each iteration.
    >
    > * Yes, yes. Listed in the JavaDocs.
     
    Boki, Oct 24, 2005
    #4
  5. Boki

    Boki Guest

    Thanks, I think the root cause is - create , create , create.... , right?

    I don't know which command can replace the data directly without create a
    new memory space?


    "David N. Welton" <>
    ???????:...
    > Boki wrote:
    >> I don't know how to check
    >>
    >> " freeMemory/totalMemory* each iteration"

    >
    >>>* Yes, yes. Listed in the JavaDocs.

    >
    > Google turns this up as the third hit:
    >
    > http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    >
    > --
    > David N. Welton
    > - http://www.dedasys.com/davidw/
    >
    > Linux, Open Source Consulting
    > - http://www.dedasys.com/
     
    Boki, Oct 24, 2005
    #5
  6. Boki

    Roedy Green Guest

    On Mon, 24 Oct 2005 22:26:53 +0800, "Boki" <>
    wrote, quoted or indirectly quoted someone who said :

    > It seems that speed will become slower and slower after a while.
    >
    >Could you please advice?


    That is often a packratting problem.

    See http://mindprod.com/jgloss/packratting.html

    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
     
    Roedy Green, Oct 25, 2005
    #6
  7. Boki wrote:
    > Thanks, I think the root cause is - create , create , create.... , right?
    >
    > I don't know which command can replace the data directly without create a
    > new memory space?


    Images are immutable, so you have to create a new instance for each new
    Image used.

    --
    Darryl L. Pierce <>
    Homepage: http://mcpierce.multiply.com/
    "Bury me next to my wife. Nothing too fancy..." - Ulysses S. Grant
     
    Darryl L. Pierce, Oct 26, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page