CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: glNewList allocates 260KB!!!!

    Quote Originally Posted by Ralf Schneider View Post
    Hello,

    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.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; January 13th, 2013 at 09:39 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured