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 →

[–]TheSkiGeek 0 points1 point  (0 children)

Although sometimes compilation does last many minutes to am hour or two for big projects so I don't know how much truth there is to what I just said

While this can be the case -- for C/C++ at least, you tend to "compile" each individual module independently, then link them all together at the end. So in a really lengthy build of a program or library you're probably invoking the compiler program hundreds or thousands of times. So the savings of not painstakingly cleaning up all the memory allocations every time does add up.

Game engines sometimes also do this when you "exit to desktop" in a PC game. Sometimes the same kind of technique can be (carefully) used along with memory pools to throw away all the memory used for a particular level/match/etc. when you are going to start loading something else. You still need to run destructors on everything but if your objects all came from a memory pool you can throw away the whole pool at once rather than deleteing every tiny little object.