Artifacts Associated With Ticket 454273ffffffffffffffffffffffffffffffffff
Ticket change [72d67b7550] (rid 104933) by hemanglavana on 2001-08-22 17:03:34:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
If the expression for regexp command is dynamically generated during runtime, then it causes a memory leak. I am attaching a simple script to reproduce the problem (note that you will have to compile tcl with TCL_MEM_DEBUG flag). Here is the output of running the script on solaris2.6 platform: godel:48> ./regexp.tcl Tcl version: 8.3.3 ================== Total Total Current Current Maximum Maximum Mallocs Frees Packets Bytes Packets Bytes ------- ----- ------- ------- ------- ------- 21494 14706 6788 348516 6874 413408 Initial 21709 14890 6819 353810 6874 413408 count 10 21855 15034 6821 353835 6900 413408 count 9 21999 15178 6821 353835 6902 413408 count 8 22143 15322 6821 353835 6902 413408 count 7 22287 15466 6821 353835 6902 413408 count 6 22475 15643 6832 358217 6902 413408 count 5 22666 15823 6843 362639 6913 413408 count 4 22854 16000 6854 367021 6924 413408 count 3 23042 16177 6865 371403 6935 413408 count 2 23229 16354 6875 375345 6946 413408 count 1 godel:49> You will note that the current bytes (4th column) remain constant for first five iterations, but increases for the remaining iterations. The first 5 iterations use a constant string. This looks like a memory leak to me. We are having this leak in one of our tcl-based server. If I use "string match ..." instead of regexp, the memory leak goes away. Hemang. - foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "hemanglavana"
- subsystem initialized to: "None"
- title initialized to: "memory leak in regexp (tcl8.3.3)?"
- type initialized to: "Bug"
Add attachment "regexp.tcl" [fad7938473] (rid 91955) by hemanglavana on 2001-08-23 00:03:35.
Ticket change [b070354d5f] (rid 97980) by hemanglavana on 2001-08-23 00:03:35:
- icomment:
File Added - 9851: regexp.tcl
- login: "hemanglavana"
- mimetype: "text/plain"
- username: "hemanglavana"
- icomment:
Ticket change [ae78b2a875] (rid 101642) by hobbs on 2001-08-23 00:41:38:
- closedate changed to: "2001-08-22T17:41:38"
- closer changed to: "hobbs"
- icomment:
Logged In: YES user_id=72656 This is not surprising, and it isn't a mem leak. Tcl caches the most recent *30* regexps per thread in an RE compile cache. This allows Tcl to save on possible expensive RE compilation. You should see this number go up until 30 iters have been hit, and then the old REs will get swapped out. This number is a compiled in constant.
- login: "hobbs"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- username: "hobbs"