Content
@
https://opensea.io/collection/dev-21
0 reply
0 recast
2 reactions
Boris
@lokasan
The Day I Spent 6 Hours Chasing a Memory Leak in C++ A few weeks ago, I was working on a high-performance logging module for a real-time application in C++. Everything was running fine… until we left the app running overnight. Next morning? 2 GB of RAM usage. Oops.
1 reply
0 recast
0 reaction
Boris
@lokasan
The Symptom The process was slowly consuming more and more memory — a classic sign of a memory leak. I ran a quick task manager check, confirmed the trend, and then dove into the codebase. The suspicious code was a simple logger with an internal cache: void logMessage(const std::string& msg) { char* buffer = new char[msg.size() + 1]; strcpy(buffer, msg.c_str()); logQueue.push_back(buffer); } Looks harmless at first glance… until you realize: 👉 nothing frees that memory. And since we log constantly, this leaked on every call.
1 reply
0 recast
0 reaction