Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Uncompiled lassign fails on large lists with memory allocation failure

Closed / Fixedd90fee06d04a0d52397dfba79e263d932f685707Created 4 years agoUpdated 4 years ago
Descriptionmarkdown2023-04-11 16:18:52

The following works

% set l [testbigdata list 0x100000001]; llength $l
4294967297
% lassign $l x ; set x
0

The following fails with a memory allocation failure.

% set lassign lassign
lassign
% llength $l
4294967297
% $lassign $l x; set x

The difference is because the compiled version makes use of the ListSpan internal representation while Tcl_LassignObjCmd does not.

Referenced by2
apnadkarni Ticket [d90fee06d0]: 4 changes [History diff]2023-04-12 16:16:25
apnadkarniplain2023-04-22 09:53:21
Although 8.7 does not have the memory issue (it can't support such large allocations anyways), it also would benefit from using list ranges for performance reasons.
apnadkarniplain2023-04-23 06:13:27
Fixed in [3509f8a4db] (8.7) and [8b91a4a3c6] (9.0).
Log in (anonymous is fine) to add a comment.