Artifacts Associated With Ticket 3067036
Ticket change [afdaf05f0e] (rid 97884) by sbron on 2010-09-15 17:52:43:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
The code below goes into a busy loop with 100% cpu usage: set f [open /dev/null] chan configure $f -blocking 0 -translation binary set str [read $f 2] append str [binary format a* foo] The problem is in TclAppendBytesToByteArray(). This function tries to calculate the needed memory by doubling the currently allocated space until it is big enough. That method fails miserably when starting with an allocated space of size 0, as is the case in the code above.
- foundin initialized to: "obsolete: 8.6b1.1"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "sbron"
- subsystem initialized to: "12. ByteArray Object"
- title initialized to: "Appending to 0-length byte array causes busy loop."
- type initialized to: "Bug"
Add attachment "tclBinary.c.patch" [52593bfae8] (rid 126302) by sbron on 2010-09-16 00:52:43.
Ticket change [a52f09386d] (rid 110328) by sbron on 2010-09-16 00:52:44:
- icomment:
File Added - 386772: tclBinary.c.patch
- login: "sbron"
- mimetype: "text/plain"
- username: "sbron"
- icomment:
Ticket change [1dee5e9725] (rid 90889) by andreas_kupries on 2010-09-16 00:58:11:
- icomment:
Interesting. I remember seeing a different place where memory doubling was done which did things a bit differently: It doubled the length of the "requested" space, not the current one. As 'requested > allocated' this could never be 0. ... Remembering more, that was somewhere in appending to a list. I guess the "appending to string/bytearray" should be rewritten to the same scheme.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [234fd352b5] (rid 130901) by dgp on 2010-09-16 01:14:20:
- icomment:
FWIW, I think it would be good to cover as many of these growth algorithms as possible with just one (set of) macro templates.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [417b460f45] (rid 116199) by dkf on 2010-09-16 05:14:11:
- closedate changed to: "2010-09-15T22:14:11"
- closer changed to: "dkf"
- icomment:
allow_comments - 1 Fixed in HEAD by jumping straight to enough space in the zero-allocated-before case.
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dkf"