|
2001-08-23
| ||
| 00:41 | • Closed ticket [454273ffff]: memory leak in regexp (tcl8.3.3)? plus 7 other c... artifact: ae78b2a875 user: hobbs | |
| 00:03 | • Add attachment regexp.tcl to ticket [454273ffff] artifact: fad7938473 user: hemanglavana | |
| 00:03 | • Ticket [454273ffff] memory leak in regexp (tcl8.3.3)? status still Open with... artifact: b070354d5f user: hemanglavana | |
|
2001-08-22
| ||
| 17:03 | • New ticket [454273ffff]. artifact: 72d67b7550 user: hemanglavana | |
memory leak in regexp (tcl8.3.3)?
Closed / Invalid454273ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-08-22 17:03:34
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.
hemanglavanaplain2001-08-23 00:03:35
File Added - 9851: regexp.tcl
hobbsplain2001-08-23 00:41:38
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.
Log in (anonymous is fine) to add a comment.
Attachments:
- regexp.tcl [download] added by hemanglavana on 2001-08-23 00:03:35. [details]