Overview
| Artifact ID: | a9efa64d2c838a6d7db4dd2aa7ddda789da2ce982d7ff000d33dd20748f16e4d |
|---|---|
| Ticket: | 54329e39c757ee2aac298a142ecfe2a7ebe72391
Compiled foreach uses excessive memory for lseq sequences |
| User & Date: | apnadkarni on 2023-07-11 10:55:35 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-markdown"
- comment changed to:
This is a memory usage issue, not bug. As shown below, a foreach loop over a lseq within a proc results in a loss of the memory efficiency benefit of lseq. ``` % set l [lseq 1000000]; llength $l 1000000 % proc getmem {} {set fd [open /proc/[pid]/statm]; return [read $fd][close $fd]} % getmem 6026 1777 1468 558 0 412 0 % foreach x $l {} % getmem 6026 1777 1468 558 0 412 0 % proc p l {foreach x $l {}} % p $l % getmem 17731 13556 1477 558 0 12117 0 ``` Notice the jump in memory usage after the loop in the proc. The same loop on the command line does not increase memory. I suspect the cause is the use of Tcl_ListObjGetElements somewhere in the execution engine in lieu of Tcl_ListObjIndex. - foundin changed to: "9.0"
- is_private changed to: "0"
- login: "apnadkarni"
- priority changed to: "5 Medium"
- private_contact changed to: "9546e9877f1a8899e25a89082561ee694e7fb402"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "apnadkarni"
- subsystem changed to: "- New Builtin Commands"
- title changed to:
Compiled foreach uses excessive memory for lseq sequences
- type changed to: "Bug"