memory checking between glNewList() and glEndList(


I have to crate lots of lists. Sometimes memory is an issue. Memory may run out to store lists. Is there a way to know when this happens between the following two commands? Any help is much apprecaited.

glNewList(oglList, GL_COMPILE);
… // store opengl lists


GL_OUT_OF_MEMORY is generated if there is insufficient
memory to compile the display list. If the GL version is 1.1
or greater, no change is made to the previous contents of
the display list, if any, and no other change is made to the
GL state. (It is as if no attempt had been made to create
the new display list.)