I have a big problem in my app.
Many times I create a displaylist, the following function allocated approx. 260KB!
I figured this out by checking the memory consumption right before and after the function with GlobalMemoryStatus().
Important: there is no other function between the GlobalMemoryStatus-call.
It is only the call to "glNewList".
This leads to a secure problem: after creation of 1000 displaylists, it can be possible, that 1000x 260KB are allocated.
but the problem is that glEndList do not release the memory.
Where in the documentation does it say glEndList "releases memory"?
In your original post, you were afraid of many different 260MB being created, and OReubens pointed out that glEndList must be called to replace an existing list. Now that you are calling glEndList, does the issue of creating thousands of different lists been resolved? If it has, then what's the problem?
If it's still the 260KB, the probable reason is that these functions have nothing to do with how the internal heap manager operates. It is the job of the heap manager to return memory back to the OS -- using functions such as GlobalMemoryStatus or even tools such as Task Manager cannot be used to accurately pinpoint whether you have a memory leak, unless you're directly calling functions such as GlobalAlloc() or HeapAlloc(). Since you're not doing that, then there is no issue.
The only time GlobalMemoryStatus or even task manager is useful is if your memory usage was steadily increasing, but you're just calling the same functions over and over again that are supposed to create and destroy resources, whatever those resources happen to be. Then that is clear sign of a memory leak. If the memory usage remains stable and you are definitely calling the functions correctly, then there is more than likely no memory leak.
The heap manager is smart enough to figure out that you may need the memory again, therefore it doesn't return the memory back to the OS immediately -- instead it holds it in reserve for subsequent allocations.
Last edited by Paul McKenzie; January 13th, 2013 at 08:39 AM.