java - Heap allocation causes significant FPS drop after few restarts - LIBGDX -
this how load textureatlases each time restart level uses different textureatlas:
public void loadalltextures(){ if(atlas_main!=null) atlas_main.dispose(); if(atlas_secondary!=null) atlas_secondary.dispose(); assets.clear(); assets.load(main_atlasaback1_atlas, textureatlas.class); assets.load(main_atlasaback1_skin, skin.class); assets.finishloading(); if(!assets.isloaded(main_atlasaback1_atlas)){ try { thread.sleep(250); } catch (exception e) { e.printstacktrace(); } } else { atlas_main = assets.get(main_atlasaback1_atlas); } if(!assets.isloaded(main_atlasaback1_skin)){ try { thread.sleep(250); } catch (exception e) { e.printstacktrace(); } } else { skin_main = assets.get(main_atlasaback1_skin); } assets.load(main_atlas_sec_atlas, textureatlas.class); assets.finishloading(); if(!assets.isloaded(main_atlas_sec_atlas)){ try { thread.sleep(250); } catch (exception e) { e.printstacktrace(); } } else { atlas_secondary = assets.get(main_atlas_sec_atlas); } atlas_main.gettextures().first().bind(); atlas_secondary.gettextures().first().bind(); }
on weaker (hardware-wise) phones after 5-10 level restarts fps drops constant 60-61 fps 15-20 fps or barely moving @ all. each , every time call loadalltextures
grow heap (frag case)
in logcat. here screencap:
how can avoid heap alloc , restart levels number of times want?
Comments
Post a Comment