faboussard / 42-irc

3 stars 1 forks source link

[Server] Still reachable in `Server::fetchStartTime()` #14

Closed ysengoku closed 3 weeks ago

ysengoku commented 3 weeks ago

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.

ysengoku commented 3 weeks ago

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.