java - Rendering textures causing memory leak -
I have this code inside my game. It provides a texture that acts as a button:
Private Zero Leftstart () {startTexture = New Texture (Gdx.files.internal ("start.png")); StartTexture.setFilter (Texture Filter.Linayer, Texture Filter Lighter); StageStart = new phase (); StageStart.clear (); Button start = new image (start style); ButtonStart.setX (10); ButtonStart.setY (Gdx.graphics.getHeight () / 2.75f); ButtonStart.setWidth (Gdx.graphics.getWidth () / 4); ButtonStart.setHeight (Gdx.graphics.getHeight () / 4); Gdx.input.setInputProcessor (stageStart); Button start.edListener (new clickistener) {public boolean touchdown (input event event, float x, float y, int pointer, int button) {currentState = GameState.RESET; startTexture.dispose (); Phase: start.expose (); Return truth; }}); StageStart.addActor (buttonStart); StageStart.draw (); StartTexture.dispose (); }
However, whenever I put the drawStart (); In my render method, the Java heap and the original pile gradually increases to 1 every 10 seconds. Therefore, if the user leaves the menu on the game for approximately 5 minutes then the game will crash on their phone. I have tested it and it only happens when texture is provided.
I would appreciate any help in fixing it. I have tried a statement which states that = 0 provides, renders texture, then sung is set 1 but it does not work.
"post-text" itemprop = "text"> This can help you to pull only in your render so you can now insert a drop-down in your render method, Do not forget to call for settlement, except for the screen and disposal.
Private Zero Draft Start () {stageStart.draw (); } Public Zero Start () {startTexture = New Texture (Gdx.files.internal ("start.png")); StartTexture.setFilter (Texture Filter.Linayer, Texture Filter Lighter); StageStart = new phase (); StageStart.clear (); Button start = new image (start style); ButtonStart.setX (10); ButtonStart.setY (Gdx.graphics.getHeight () / 2.75f); ButtonStart.setWidth (Gdx.graphics.getWidth () / 4); ButtonStart.setHeight (Gdx.graphics.getHeight () / 4); Gdx.input.setInputProcessor (stageStart); Button start.edListener (new clickistener) {public boolean touchdown (input event event, float x, float y, int pointer, int button) {currentState = GameState.RESET; startTexture.dispose (); Phase: start.expose (); Return truth; }}); StageStart.addActor (buttonStart); } Public Zero Disposal () {startTexture.dispose (); }
Comments
Post a Comment