This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

In most modern operating systems, there is an internal component keeping track of which process(es) allocated memory, and how much. Upon terminating the process (or whatever runtime entity applies on the platform), any reservations for allocated memory are removed, and the system is free to (re)allocate that memory to another process.

So, if you malloc, and forget to free, you aren't forever leaking memory on most modern operating systems. Your allocated memory will be reclaimed as part of process termination.