I have to render mesh array in using libgdx in render(). I used handler because every time I’m getting new data in getMeshToRender() method in meshArr array.
onCreate()
{
handler.removeCallbacks(sendUpdatesToUI);
handler.postDelayed(sendUpdatesToUI, 1000); // 1 second
}
Runnable sendUpdatesToUI = new Runnable()
{
public void run()
{
//DisplayLoggingInfo();
getMeshToRender();
handler.postDelayed(this, 1000); // 1 seconds
}
};
getMeshToRender()
{
.......
meshArr = new Mesh[numMesh];
.......
}
in Render() method it initially loads that meshArr but then crashes with OutOfMemoryError.
Any solution will be aprreciable.
Thanks
The simple, and only real, answer is to use less memory.
Either you are just using too many different meshes, and you should rethink your whole idea, or you are replacing them and not properly disposing of the old ones.
If you want to release unused meshes, you should use
Mesh#dispose()