The destructor method is used to release all the allotted memory when the program exits. The destructor method is the correct answer.
Let's suppose that the program creates 1000 entries of contact information in any contact book program. When the program runs, these number of entries get into memory, and memory is allocated to object contactinfo that stores the 1000 entries.
If the number of entries gets larger then obviously the system will throw a run-out of memory. The best practice is to use the destructor method. The destructor method releases all the allocated memory when the constructor-created object is destroyed. The destructor method releases the memory that is created by the constructor.
You can learn more about destructor method at
https://brainly.com/question/13779049
#SPJ4