×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    5

    Repaint cause Memory Leak on KVM

    Hi everyone,

    I try to develop a graphic application. After I load some PNG, I've got a memory leak everytime when I call repaint() method.

    Any idea?

    Thanks.

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    23
    did you set those image objects that never used again to null?

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    5
    Yes, I did.

    But the Memory Leak is only happen when I call the Repaint() function.

    Any idea? Thanks.

    Kit

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    23
    I am not sure about your problem. But maybe you can try to use gc(). In my program, memory useage continue to increase. But after I use gc() a lot of memroy been released. Even I don't use gc() manually, system automatically call it when free memory used out. By the way, review your program to ensure that there is no any object that never used again but still in reference. Such objects isn't collected by gc and may cause memory leak.
    Hope it helps.
    Last edited by bitsonic; 2003-04-08 at 16:01.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    40
    I encounter the same problem.
    Even the Nokia Blockgame heap memory is growing in the emulator status all the time.
    When it's full it seem to reset to zero and start all over again.

    -Peter

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    5
    pvermeulen: Would it be the SDK bug??

    bitsonic: I did your approach. It can resolve my problem but it that gc() should occur everytime when I call object = null???

    Thanks,

    Kit

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    23
    Acutally, system may not immedially call gc() after you set objects to null. Unless you manually call gc(). To my knowledge, only when there is not enough memory would the system call gc() to collect those unused objects and to release memory. That is why someone saw memory usage increasing and then reduce suddenly.

  8. #8
    Registered User
    Join Date
    Mar 2003
    Posts
    5
    oic.

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    40
    I don't know if it's an SDK bug (3510i sdk) ?

    I'm new to J2ME programming (I actually only started this week) ; but my game should be finished next week and not being able to check for memory leakes is quite annoying.

    If anyone else that is using the 3510i sdk encounters the same problem please post here..

    Thx,

    -Peter

Posting Permissions

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