How many OpenGL contexts are safe?

How many OpenGL contexts can be safely running in a single application at any given time?

On my personal box (Linux 2.4.5, GF2MX, latest NVidia drivers) I can pretty safely cram 64 contexts into a single application window (assuming no other OpenGL programs are running). On the 65th either the application segfaults or the whole X server comes crashing down.

It wouldn’t take long for me to test out how many contexts are possible on other configurations, but ideally I could know a safe value for all hardware so I wouldn’t have to maintain a card database for my app. Similarly I know the app I’m testing with has scads of bugs but that shouldn’t make a difference with respect to the original question.

The GLX spec doesn’t appear to provide any attribute/function I can query for this. The only indication about an upper limit is provided by failing a call to glXCreateContext, but even using that is probably not useful (even if I did try to allocate as many contexts as possible before the program starts, the limits may depend on particular rendering options).

No idea…but…why do you need so many contexts?