×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    25

    Need advice on a memory leak...

    Hey folks,

    I've encountered a memory leak in a pretty large game (150k+) that I've been developing for the 7650/3650 devices... I've got different classes that handle different game states and they all allocate their own imagery and sub-classes, etc. After I'm done with each of the interfaces, I set them equal to null in the proper locations, but it seems that something isn't getting deallocated correctly... I've even tried calling System.gc() after the seemingly proper deallocation to see if it will catch something that the automatic garbage collection might have missed... Should I try releasing every single interface in the class i'm trying to deallocate? I figured that setting a parent class to null would cause all things under it to get deallocated as well, but I guess there's a possibility that I might be wrong.

    Any ideas?

    Thanks,
    Dave

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    393

    RE: Need advice on a memory leak...

    Read the Efficent MIDP Programming document. You can download it from from by navigating yourself through the following links:

    Forum.nokia.com->Java->Documents

    [N]/ Forum Nokia
    Cheers,
    Nitin

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    12

    RE: Need advice on a memory leak...

    Objects become eligible for garbage collection when there are no references to them anywhere. So if object A references objects X and Y as member variables and all references to object A are set to null then objects X and Y become eligible for garbage collection, but ONLY if there are no other references to objects X and Y. So if object A returns references to X and Y through method calls for example, and these references are maintained elsewhere in the application then they won't become eligible for garbage collection even if object A does. You should check that you don't have this sort of situation in your app.

    Did that make any sense by the way?

Posting Permissions

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