You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we call LogError() when the code encounters a problem and, if the problem is an error, then we exit early (i.e., crash for SOILWAT2 -- in case of rSOILWAT2, we call the R_int.h function error() instead).
However, we are not de-allocating dynamically allocated memory. For a single SOILWAT2 run, the program crashes and the OS may/should clean it up. However, in rSOILWAT2, we return to the calling function prematurely, and this causes a memory leak. Similarly, if we will convert SOILWAT2 in the future to run with multiple threads, then a prematurely returning thread will cause a memory leak.
Suggested solution: after we identify the problem but before we call exit() (or similar), we need to de-allocate dynamically allocated memory.
The text was updated successfully, but these errors were encountered:
* Properly handle a thrown error
* Provide premature function exiting when an error is encountered
* Guarantee memory will be freed and files are closed upon error
* Addresses #359
Currently, we call
LogError()
when the code encounters a problem and, if the problem is an error, then we exit early (i.e., crash for SOILWAT2 -- in case ofrSOILWAT2
, we call theR_int.h
functionerror()
instead).However, we are not de-allocating dynamically allocated memory. For a single SOILWAT2 run, the program crashes and the OS may/should clean it up. However, in rSOILWAT2, we return to the calling function prematurely, and this causes a memory leak. Similarly, if we will convert SOILWAT2 in the future to run with multiple threads, then a prematurely returning thread will cause a memory leak.
Suggested solution: after we identify the problem but before we call
exit()
(or similar), we need to de-allocate dynamically allocated memory.The text was updated successfully, but these errors were encountered: