NO

Author Topic: Memory Management  (Read 2295 times)

tommy

  • Guest
Memory Management
« on: January 01, 2007, 01:28:25 PM »
@Pelle: Say if I allocate memory blocks throughout the program which has to be available till the program is terminated, do I actually need to loop through all the allocated memory handles and free them afterwards to avoid memory leaks? Or do Pelles C allocate memory in a heap which is automatically freed on exit? After a quick view in OllyDbg I see a reference to HeapCreate, but I haven't had a closer look at it. If you could give me a hint that would be nice. I got other things to do than researching right now. :)

A happy new year to all of you! Keep up the good work Pelle!

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Memory Management
« Reply #1 on: January 03, 2007, 03:23:08 PM »
The small block heap, and the large block heap (where the Heap* API functions are used) will be released 'automagically' when the program terminates, so you don't need to use free() youself (but it may be considered 'good style', when possible...)
/Pelle

tommy

  • Guest
Memory Management
« Reply #2 on: January 03, 2007, 06:55:35 PM »
Ah, yes, as I thought... Thanks!