Artifacts Associated With Ticket 07000bd237c021d5
Ticket change [3f2cb31e6c] (rid 247998) by apnadkarni on 2025-11-10 16:57:22:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-markdown"
- comment initialized to:
The documentation for `Tcl_{Set,Get,Take}BigNum` needs to clarified with respect to handling of `mp_int` memory. At least, - Tcl_SetBignumObj should clarify that the passed `mp_int` is cleared by Tcl and will not hold it original value - Tcl_{Get,Take}BignumFromObj - `mp_clear` needs to be called on the returned `mp_int` values to free memory. - is_private initialized to: "0"
- login: "apnadkarni"
- priority initialized to: "5 Medium"
- private_contact initialized to: "9546e9877f1a8899e25a89082561ee694e7fb402"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "apnadkarni"
- subsystem initialized to: "56. LibTomMath"
- title initialized to:
Bignum documentation needs to be clarified w.r.t mp_int handling
- type initialized to: "Bug"
Ticket change [0bdfdcd1f0] (rid 250326) by cdubois on 2026-01-12 03:39:06:
- icomment:
Thanks for flagging this. Making the ownership/lifetime contract for mp_int explicit is important to prevent leaks and accidental misuse. I agree the docs should be strict here. I will cross-check the current implementation (including Tcl_TakeBignumFromObj behaviour for shared vs unshared objects) and then propose a documentation patch. Proposed doc clarifications (subject to confirming the implementation): - Tcl_SetBignumObj: clarify whether the function clears/consumes the supplied mp_int (i.e., callers must treat it as cleared and not rely on its prior value after the call). - Tcl_GetBignumFromObj / Tcl_TakeBignumFromObj: clarify whether the caller must call mp_clear on the mp_int they receive/populate to release internal allocations, and what postconditions apply to the source object in the Take case. I can also add a minimal code snippet illustrating the correct cleanup pattern.
- login: "cdubois"
- mimetype: "text/plain"
- icomment:
Ticket change [47dcfd7e07] (rid 250375) by apnadkarni on 2026-01-14 14:56:51:
- icomment:
@cdubois, Great, a documentation patch would be greatly appreciated. It is really quite confusing as it stands.
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment: