ddnet
                                
                                
                                
                                    ddnet copied to clipboard
                            
                            
                            
                        m_vPending in log.cpp is a memory leak device
Every chat message leaks 4000bytes
As far as I can tell m_vPending does nothing, but I could be wrong. I could only observe it getting cleared when the game launches and it also doesn't get accessed otherwise.
Seems like this is the pending log messages for the future file logger, which never get cleared if no logfile is set on client/server side.
As a workaround, you can set a logfile, which should prevent the leak.
If I set a log file then wouldn't it fill up my hard drive with the messages instead of my ram?
If I set a log file then wouldn't it fill up my hard drive with the messages instead of my ram?
Yes, but more slowly because it wouldn't allocate 4 KiB for every log message but only write as many bytes as the messages contain.
For me this isn't a viable solution. I've just removed m_vPending from my build for now. The chat system can handle billions of messages no problem without this logging code.
Alternatively as a workaround you could try setting /dev/null as a log file, but then its still doing unnecessary work. Not logging to file shouldn't leak memory tho.