Tcl-bounties
Tcl-bounties copied to clipboard
Memory Leak in tclIO.c
Not sure if this is the correct forum for this, but I'll give it a shot.
I'm seeing a significant memory leak that seems to be caused by Tcl's puts command.
In the Write function defined in generic/tclIO.c, it appears that the ref count for the ChannelBuffer pointed to by *bufPtr will never reach 0 and will thus leak memory.
When AllocChannelBuffer is called, it sets the ref count to 1. PreserveChannelBuffer is then called and increases it to 2. There will only be one call to ReleaseChannelBuffer before bufPtr goes out of scope leaving the ref count at 1.
Maybe I'm missing something about how ref counts are supposed to be used and if so, I'd appreciate some guidance.
Thanks! Brian
https://core.tcl-lang.org/tcl/ticket here?
I would bring it up on the #tcl channel on chat.freenode.net
Closing, since this is not the proper place to report bugs.