On reconsidering this, memory usage starting low, followed by an increase then stabilize is probably nothing to be worried about. It's where the stabilize part doesn't happen that you need to start worrying (that's a real leak - stabilization isn't a leak, it's just using resources). What's actually happening would be internal driver behaviour so we're reduced to guessing here, but going by your final stripped down program a reasonable and plausable guess would be that the driver is buffering up geometry used by immediate mode calls - it may for example be writing them into a dynamic VBO and then issuing real draw calls behind the scenes from that.
Thanks. We realized this is true. From here:
It seems to be common to think that there is a memory leak in the OpenGL driver. Some users write simple programs such as this
and they observe that their memory usage goes up each time their Display function is called. That is normal. The driver might allocate some memory space and since the driver is basically a black box, we don't know what it is doing. The driver might be doing some work at optimizing in a secondary thread or preparing some buffering area. We don't know what it is doing, but there is no memory leak.
The problem is, in our application we're dealing with many OpenGL contexts at once (up to 30). For Windows XP on the same hardware, OpenGL memory is small compared to Windows 7. So in a day my application memory goes up to 1.5 GB on Win 7, but stays at 500 MB on XP.
We'll either require more memory or reduce the number of contexts used.
Thanks for the useful input everyone.