Tcl-bounties icon indicating copy to clipboard operation
Tcl-bounties copied to clipboard

Memory Leak in tclIO.c

Open bsassone opened this issue 3 years ago • 2 comments

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

bsassone avatar Jan 07 '22 01:01 bsassone

https://core.tcl-lang.org/tcl/ticket here?

wrenashe avatar Jan 07 '22 03:01 wrenashe

I would bring it up on the #tcl channel on chat.freenode.net

resuna avatar Jan 07 '22 21:01 resuna

Closing, since this is not the proper place to report bugs.

bovine avatar Apr 26 '23 20:04 bovine