gluCylinder memory leak


when I run a test loop like this:

for (int s=0; s<1000; s++)
	GLUquadricObj *pQuadObjPrivate = gluNewQuadric();
	gluQuadricDrawStyle(pQuadObjPrivate, GLU_FILL);

	gluCylinder(pQuadObjPrivate, nbase, nTop, nHeight, nSlices, nStacks);


I get 100’s of MB of working set size increase and quickly paging brings the system to snail speed. Does anyone know what else needs to be done to clean up the quadric’s memory use?


As I just found, the memory usage in above example is greatly dependent upon the # of slices and # of stacks, try 360 for each of them. This phenomenon also shows if only the gluCylinder() call is left in the for() loop. In above example I was trying to force cleanup but that doesn’t seem to make a difference…


To make it short: don’t use them ^^ This appears to be a bug in GLU. Also, you don’t need to create a new quadric for each object you render – one quadric for your app shoulb be enough. Remember that all GLU helper routines are not written for performance (and they are slow!).

isn’t 360 a tad high for slices and stacks? Try 16 or so for starters then increment gradually from there.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.