Is there a limit in the number of display lists?

I wonder if there is a predefined limit on the number of display lists you can have or are they limited only by available memory?

No predefined limit. It only depends on the implementation (and of course video ram available).

Display list IDs are GLuint, so the limit is
(2^(bits representing GLuint))-1
e.g. on 32 bit systems all IDs from 1 to 0xFFFFFFFF.
Generating all IDs alone will exceed the 2-3GB virtual address space on Win32. :wink: So, the number of display lists is practically only depending on your system’s memory.
To catch GL_OUT_OF_MEMORY conditions during display list compilation you need to call glGetError after each glEndList.