Display list memory problems

Started by dax105, May 20, 2014, 20:59:24

Previous topic - Next topic

dax105

Hi, I'm trying to create a Minecraft clone that can run on very old PCs, so I'm trying to use the oldest openGL version possible.

Each chunk of world (16*64*16 blocks) has its own display list that's called on each render.
Each time a chunk of world changes (block removed/added | unloads/loads), I delete the old display list using GL11.glDeleteLists, then generate a new one using GL11.glGenLists and draw the chunk geometry into it.

The problem is that each time I do the chunk geometry rebuild, the java process takes a little bit more memory (but heap stays same) and after alot of rebuilds the process can take even 3GB of ram, but the heap stays on approx. 100MB. Could anyone tell me what am I doing wrong? Thanks.

//I'm also sorry about my bad english, but It's not my native language.

ra4king

Hard to tell without seeing exactly what you're doing.
-Roi

dax105

Okay, I solved it and I feel really dumb now. What I had in my delete render chunk code was this:
public void delete() {
	for (int i = 0; i < TOTAL_PASSES; i++) {
		if (listsPresent[i]) {
			GL11.glDeleteLists(i, 1); //Yeah, I was deleting the 0-2 integer, lol
		}
	}
}


It must've been a typo, I was really tired or something, all I had to do is this, and now it works perfectly:
public void delete() {
	for (int i = 0; i < TOTAL_PASSES; i++) {
		if (listsPresent[i]) {
			GL11.glDeleteLists(listIDs[i], 1);
		}
	}
}


I'm really sorry that I bothered you, next time I'll try to check my code more before posting.