I was trying to monitor the memory usage of my game using jconsole (The build in tools from the JDK). I found out that the gc is called every about 3 minutes because the heap allocation increased by about 3 MB every 3 seconds. I'm trying to look for the cause by simplifying my render loop to be as simple as possible, until the only code left is this :
public void render() {
camera.update();
Gdx.gl.glClearColor(0.5f, 0.2f, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.setProjectionMatrix(camera.combined);
batch.setColor(1f, 1f, 1f, 1);
for( int y = 0 ; y < l1BlockedNd.size ; y++){
batch.draw(pmxTexture[0], l1BlockedNd.get(y).getPosX() * 10, l1BlockedNd.get(y).getPosY() * 10);
}
}
When I removed the batch.draw call, I found out that the heap is no longer increasing... It's strange since I didn't make any new object at all. What have I done wrong?