Overview
| Artifact ID: | 9757ecafac287a9a62dd430d82f9e594410ff31488a8628e88ef01499fa8220b |
|---|---|
| Ticket: | 275db3d98511dbc2bb50109c3e4fe7501dff9896
Memory leak in zipfs |
| User & Date: | apnadkarni on 2026-04-13 07:07:35 |
Changes
- icomment:
Bisect points to [42764583](https://core.tcl-lang.org/tcl/info/427645831a). The change to using `Tcl_ExternalToUtfDStringEx` loses dynamic memory already allocated to the passed `Tcl_DString` (it assumes it is uninitialized and overwrites the fields). I think the original code was optimized to not require reallocation of memory for every file in a zip for long pathnames. Possible solutions are 1. Revert above commit but I'm unclear as to whether the commit was primarily code reduction or also a bug fix. 2. Call `Tcl_DStringFree` before the call to `Tcl_ExternalToUtfDStringEx` which would be (potentially) a performance hit requiring new memory free/allocation on every zipfs entry (when paths exceeded `Tcl_DString` static size). 3. Modify `Tcl_ExternalToUtfDStringEx` to accept a flag when the output `Tcl_DString` has already been initialized. But requires a TIP.
- login: "apnadkarni"
- mimetype: "text/x-markdown"