Ticket UUID: | 92aeb847f9b92cfbd281e9263be3f019ad59192b | |||
Title: | proc with more than 2**31 variables | |||
Type: | Bug | Version: | 9.0 | |
Submitter: | jan.nijtmans | Created on: | 2025-04-10 14:21:03 | |
Subsystem: | 22. [proc] and [uplevel] | Assigned To: | jan.nijtmans | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2025-04-15 22:21:55 | |
Resolution: | Fixed | Closed By: | jan.nijtmans | |
Closed on: | 2025-04-15 22:21:55 | |||
Description: |
Example (by Ashok): % proc xx [lrepeat 0x100000000 x] {} killed Note that this has no relation to TIP #626: Those examples don't have more than 2**31 command lines arguments, the "proc" command just has it's second command-line argument being a list with 2**31 arguments. Since Tcl 9.0 already allows large list sizes, Tcl 9.0 should already be able to handle this. Since a proc with that many variable is unrealistic, setting this ticket as "minor" | |||
User Comments: |
jan.nijtmans added on 2025-04-15 22:21:55:
Fixed [3af3ca8d988e9a1f|here] jan.nijtmans added on 2025-04-14 07:57:45: After better fix: $ ./tclsh % proc xx [lrepeat 0x100000000 x] {} total mallocs 163959265 total frees 130503 current packets allocated 163828762 current bytes allocated 41896099036 maximum packets allocated 163828762 maximum bytes allocated 41896099036 procedure "xx": memory error % Actually, it depends where the allocation error occurs. It might happen in a Tcl_Alloc(), it also might happen in Tcl_CreateHashEntry(). In the first case, we might use Tcl_AttemptAlloc() and do a proper cleanup. In the other case, we would need a Tcl_AttemptCreateHashEntry() (TIP!) jan.nijtmans added on 2025-04-10 14:46:19: After 'fix': $ ./tclsh % proc xx [lrepeat 0x100000000 x] {} total mallocs 202168073 total frees 130242 current packets allocated 202037831 current bytes allocated 43653712110 maximum packets allocated 202037831 maximum bytes allocated 43653712110 procedure "xx": arg list contains too many (4294967296) entries % % % exit |
