Thrown exceptions can interrupt the normal control flow of a program, sometimes leaving behind dynamically allocated mem

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Thrown exceptions can interrupt the normal control flow of a program, sometimes leaving behind dynamically allocated mem

Post by answerhappygod »

Thrown Exceptions Can Interrupt The Normal Control Flow Of A Program Sometimes Leaving Behind Dynamically Allocated Mem 1
Thrown Exceptions Can Interrupt The Normal Control Flow Of A Program Sometimes Leaving Behind Dynamically Allocated Mem 1 (34.08 KiB) Viewed 23 times
Thrown exceptions can interrupt the normal control flow of a program, sometimes leaving behind dynamically allocated memory that is not released. What is considered the best way to prevent memory leaks when an exception is thrown? None of these. Storing the memory to be released in a catch parameter to be deleted by whoever catches it Using objects within functions and having the object destructor release the memory. Having each function that must release memory institute its own try/catch block where it can delete the memory.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply