View Full Version : glDrawArrays() bug or incorrect use?

04-16-2010, 07:41 AM
I have an issue with the glDrawArrays() function in my program. When calling the function with arguments that specify a large number of indices the function consumes an enormous amount of RAM; worse, the amount is not fixed but simply increases very swiftly until it has consumed all free RAM on the system (on this particular system, 6 GiB) and then the program is killed by the OS.

My own first thought was that my program obviously had to have a memory leak, a huge one. However I couldn't find one, and if I simply comment out the glDrawArrays() call, then the program uses almost no memory at all (in comparison) and it certainly doesn't spiral out of control and crash like when I allow the glDrawArrays() call.
Furthermore I also learned that if I reduce the number of indices to be drawn in the call (e.g. to 1/4 the original number), then there is also no longer a problem.

By large, I mean that the issue manifests itself when the number of indices is (e.g.) ~ 33841152

However the problem doesn't seem to occur when the number of indices is (e.g.) ~ 8500000.

If it is obvious what the problem is then I'd be very happy if someone could tell me what it is. :-)

Thanks in advance!

05-26-2010, 09:19 PM
I am getting the same problem. I am running on Fedora Linux with the Nvidia OpenGL drivers. The memory use increases with the number of calls to glDrawArrays until it peaks at about 5.5GB. Comment out the one call to glDrawArrays and memory is negligible. I've found no solution yet.

Did you ever find a resolution to this? Which OS and OpenGl drivers are you using?

05-27-2010, 05:29 AM
You may well be overflowing the max amount of vertexes that your hardware can support. I'm not certain if there's a glGet for this.