Memory leaks
Some online documents say you should:
- Always
call the destroy_bitmap function
- For every memory bitmap that you create
- To avoid memory leaks.
I have long believed (perhaps
erroneously)
- That all of the memory used by a program
- Is returned to the
operating system when the program terminates.
If so, the call to
destroy_bitmap in Listing 5 is overkill:
- Because the call is made
immediately before the program terminates.
I decided to err on
the side of caution and make the call to destroy_bitmap anyway.