|
2003-11-01
| ||
| 08:33 | • Closed ticket [829027ffff]: lrepeat segfaults for big lists plus 7 other cha... artifact: 95b4390ca3 user: dkf | |
| 06:13 | • Ticket [829027ffff]: 4 changes artifact: 4d6108abb7 user: dkf | |
|
2003-10-24
| ||
| 16:33 | • Ticket [829027ffff]: 5 changes artifact: edb1ffe945 user: dkf | |
| 04:11 | • Add attachment 829027.patch to ticket [829027ffff] artifact: da5271e9c8 user: dgp | |
| 04:11 | • Ticket [829027ffff] lrepeat segfaults for big lists status still Open with 4... artifact: 57c53a2423 user: dgp | |
| 03:16 | • Ticket [829027ffff]: 4 changes artifact: 3d3324d075 user: dgp | |
| 03:12 | • Ticket [829027ffff]: 4 changes artifact: ae657d89c6 user: dgp | |
| 03:03 | • Ticket [829027ffff]: 4 changes artifact: 3338bd58cb user: dgp | |
|
2003-10-23
| ||
| 16:42 | • New ticket [829027ffff]. artifact: 620bf20ea7 user: dgp | |
lrepeat segfaults for big lists
Closed / Fixed829027ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2003-10-23 16:42:53
out of memory panics are one thing, but
really big list lengths appear to produce
a different segfault:
% lrepeat [expr {1<<25}] a; concat
% lrepeat [expr {1<<26}] a; concat
unable to alloc 268435456 bytes
Abort
% lrepeat [expr {1<<28}] a; concat
unable to alloc 2147483648 bytes
Abort
hamming:solaris: ./tclsh
% lrepeat [expr {1<<29}] a; concat
Segmentation fault
dgpplain2003-10-24 03:03:16
Logged In: YES user_id=80530 This appears to be integer overflow in the argument to ckalloc(). As observed in the chat: jenglishWith 32-bit ints, (1 << 30) * sizeof(int) == (1 << 32) == 0.
dgpplain2003-10-24 03:12:11
Logged In: YES user_id=80530 Also contributing is that there's a sizeof(Tcl_Obj) where there should be a sizeof(Tcl_Obj *).
dgpplain2003-10-24 03:16:34
Logged In: YES user_id=80530 Use of attemptckalloc leading to a TCL_ERROR and error message when insufficient memory would also be better than the panic.
dgpplain2003-10-24 04:11:54
File Added - 65247: 829027.patch Logged In: YES user_id=80530 The usage of attempckalloc is trickier than it first appears, given the use of ckalloc within the Tcl_ListObj* routines. Here's a patch dealing with just the original report.
dkfplain2003-10-24 16:33:09
Logged In: YES user_id=79902 SEGV's bad; boosting prio
dkfplain2003-11-01 06:13:41
Logged In: YES user_id=79902 [lrepeat] really ought to soft-fail when insufficient memory is available, but doing that is tricky because you have to tell the list constructor that it now has ownership of an array, instead of the current technique which is a copy. OTOH, there is definitely still utility in allocating such arrays since you can use [lset] to manipulate them safely. Sounds like a new (internal) function: TclNewListObjDirect()
dkfplain2003-11-01 08:33:54
Logged In: YES user_id=79902 Fixed (as far as I can tell - these memory-allocation-failure things are awkward for me to test for assorted not very nice reasons) and performance-engineered a bit at the same time.
Log in (anonymous is fine) to add a comment.
Attachments:
- 829027.patch [download] added by dgp on 2003-10-24 04:11:54. [details]