Bug description
One of the constructors in emp::DataFile doesn't take an std::ostream, instead it takes a filename string.
It then uses that string to create a new std::ostream pointer. However, this pointer (os) is never deleted. Since it's not an Empirical pointer, this is not detected in debug mode.
To Reproduce
The DataFile example (examples/data/DataFile.cpp) has this issue without any modifications.
Here's the valgrind command I used to show the issue:
Expected behavior
Removing the memory leak is the main priority.
Switching the os pointer to be an emp::Ptr would improve consistency with rest of codebase.
Destructor and copy/move constructors will likely need to be updated to accommodate issue (rule of five).
Toolchain (please complete the following information):
OS: Pop!_OS 21.04
Compiler: gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1)
Empirical Version master at 1fe7f9008c3fc2e5f2d13addc4183175f3d5848e
Bug description One of the constructors in
emp::DataFile
doesn't take anstd::ostream
, instead it takes a filename string. It then uses that string to create a newstd::ostream
pointer. However, this pointer (os
) is never deleted. Since it's not an Empirical pointer, this is not detected in debug mode.Relevant code (line 52 at time of writing):
To Reproduce The DataFile example (
examples/data/DataFile.cpp
) has this issue without any modifications. Here's the valgrind command I used to show the issue:Expected behavior Removing the memory leak is the main priority. Switching the
os
pointer to be anemp::Ptr
would improve consistency with rest of codebase. Destructor and copy/move constructors will likely need to be updated to accommodate issue (rule of five).Toolchain (please complete the following information):
master
at 1fe7f9008c3fc2e5f2d13addc4183175f3d5848e