Destroying the off-screen bitmap buffer
Listing 5 is similar to the corresponding code in the previous program.
The difference is the call to the destroy_bitmap function in Listing 5.
Listing 5. Destroying the off-screen bitmap buffer.
//Block and wait until the user presses a key. readkey(); //Destroy bitmap to avoid memory leaks. destroy_bitmap(buffer); return 0;//Return 0 to indicate a successful run.... }//end main function END_OF_MAIN |
The call to destroy_bitmap frees the memory currently occupied by the bitmap: