When you perform operations that involve copying or modifying strings, the internal representation of the std::string might allocate memory that it holds until the program exits.
Library Behavior:
Standard library implementations can retain some memory that isn't freed immediately to improve performance on subsequent allocations. This behavior can lead to "still reachable" reports in Valgrind.
It is likely due to the C++ standard library's management of memory related to std::string, rather than a direct memory leak in your code.
Fixed: Use temporary std::string startTime instead of using directory Server class variable std::string _startTime, then assign the value to it at the end of this function.
There is still reachable: 31 bytes in 1 block.
Possible Causes
String Copying:
When you perform operations that involve copying or modifying strings, the internal representation of the std::string might allocate memory that it holds until the program exits.
Library Behavior:
Standard library implementations can retain some memory that isn't freed immediately to improve performance on subsequent allocations. This behavior can lead to "still reachable" reports in Valgrind.
It is likely due to the C++ standard library's management of memory related to std::string, rather than a direct memory leak in your code.