OpenGL / Visual C++ / Windows 2000 memory problem

Started by
5 comments, last by BSXrider 22 years, 3 months ago
When I''m writing an openGL program in visual C++ I typically ctrl-F5 it a lot. Problem is each time I do this it takes about 20MB of memory but only gives 16MB or so back. So when I''ve done it 50 times it''s eaten half of my memory. Quitting vc++ doesn''t make any difference, the memory is still "used" and I''m forced to reboot. Any ideas? This isn''t down to my sloppy programming because it does the same with something like NeHe''s Lesson 1 for openGL. - seb
Advertisement
I could understand that happening once (as Windows caches the DLL for future use), but more than once is unusual. Do OpenGL programs that you didn''t make exhibit this same behaviour? If so, what video card and drivers do you have? Does the demo from NeHe you used as a test use GLaux (which is known to leak memory)? Is there any texture loading done in the program? If either of those last two are true, try one without any texturing and check for leakage.

[Resist Windows XP''s Invasive Production Activation Technology!]
The tutorial of NeHe''s is just a very basic openGL framework. It doesn''t even draw a polygon.

All programs I''ve written that use openGL have the same problem for me under repeated compilation. VC++ programs that don''t use GL don''t seem to do this. I''m not using the glaux.h header file or functions.

- seb
Repeatably running a compiled program doesn''t have this problem, so the memory leak seems to be within vc++ itself rather than my source code.

It''s a creative labs Geforce 2 GTS running on 12.10''s I think.

- seb
No, here''s the problem:
When debugging, VC attaches itself to the primary running thread, ie the one which WinMain first starts into. WHen you hit Ctrl-F5, VC basically calls a TerminateThread on your program. Its the equivalent of using End Process in WinNT kernels. THe result is that no destructors get called, no releases occur, etc. D3D and OpenGL are both very good at detecting when they are no longer needed and need to clean up. Even so, a significant block of RAM stays used. Pointers also get lost and desktop/explorer icons change, cursors become corrupt, etc. I find that during debugging, i need to restart every 1.5-2 hours on a stabble Win98 machine, or my computer wil become seriously unstable and slow.

-----------------------------
The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
If you''re program is (presumably modified) NeHe''s tutorial 1 which "doesnt even draw a polygon" - why are you / what is using up 20megs(!) of memory?
--------------------Go Stick Your Head In A Pig
The 20MB and 16MB were just figures I made up actually. On one of my complex glut-based applications it takes 50MB and gives about 40MB back. On NeHe''s basic tutorial it''s a much smaller amount of memory (can''t remember how much) but the net result is still cumulative.

- seb

This topic is closed to new replies.

Advertisement