javaandroidgarbage-collectionandengine

System.gc will work in android(Andengine)


I developing a game using andengine. In J2me game when exit , i made all object as null

ie:

Image img;
Sprite s1;

When exit application , 

img=null;
s1=null;

In android i will use System.gc() or i need to make all texture, textureRegion and sprite as make as null, when exit appliaction ?


Solution

  • Java garbage collection should take care of that. You don't need to do that.

    However I would close open connections, file handles, etc..

    System.gc() is just a hint to the JVM that garbage collection is suggested, however Java is running it at its own will.