Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-12-03
06:24 • Closed ticket [1077474fff]: Memory leak? plus 9 other changes artifact: 2cae73d1cd user: dgp
05:33 • Ticket [1077474fff]: 4 changes artifact: e83d876ee8 user: dgp
04:35 • Ticket [1077474fff]: 4 changes artifact: 2b733d3cda user: dgp
04:25 • Ticket [1077474fff]: 4 changes artifact: 31b0f7b04b user: dgp
04:16 • Ticket [1077474fff]: 4 changes artifact: 55b1ea70eb user: dgp
03:55 • Ticket [1077474fff]: 4 changes artifact: bbb7a2aefa user: dgp
03:36 • Ticket [1077474fff]: 4 changes artifact: a84078f287 user: dgp
03:28 • Ticket [1077474fff]: 4 changes artifact: e9927cc6f8 user: dgp
03:08 • Ticket [1077474fff]: 4 changes artifact: ab988b1b5a user: msofer
02:32 • Ticket [1077474fff]: 4 changes artifact: c1eabbf32f user: hobbs
00:46 • Ticket [1077474fff]: 5 changes artifact: c0e357c21f user: msofer
2004-12-02
23:58 • Ticket [1077474fff]: 4 changes artifact: 0642ea7560 user: msofer
10:53 • New ticket [1077474fff]. artifact: 20b56da851 user: dkf

Memory leak?

Closed / Fixed1077474fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-12-02 10:53:34
compile-12.1 fails for me (config: Linux, Fedora Core
2, Tcl HEAD built with --enable-symbols=all,
--enable-threads)

==== compile-12.1 testing literal leak on interp delete
FAILED
==== Contents of test case:

    proc getbytes {} {
        set lines [split [memory info] "\n"]
        puts [lindex $lines 3]
        lindex $lines 3 3
    }

    set end [getbytes]
    for {set i 0} {$i < 5} {incr i} {
        interp create foo
        foo eval {
            namespace eval bar {}
        }
        interp delete foo
        set tmp $end
        set end [getbytes]
    }
    rename getbytes {}
    set leak [expr {$end - $tmp}]

---- Result was:
20736
---- Result should have been (exact matching):
0
==== compile-12.1 FAILED
msoferplain2004-12-02 23:58:50
Logged In: YES 
user_id=148712

Reproed under --enable-symbols=mem (no threads); leak is
5328 here
msoferplain2004-12-03 00:46:43
Logged In: YES 
user_id=148712

Leak is real, and independent ofcompile flags. With a normal
build, you can watch (in top) as a tclsh running
   while i {interp create a; interp delete a}
grows in memory used.
hobbsplain2004-12-03 02:32:07
Logged In: YES 
user_id=72656

I cannot confirm this for 8.4.9 or HEAD on Windows.  Unix
only??  Testing with:

make shell
% while 1 { interp delete [interp create a] }
msoferplain2004-12-03 03:08:49
Logged In: YES 
user_id=148712

The leak was not there in 8.5a1
dgpplain2004-12-03 03:28:11
Logged In: YES 
user_id=80530

leak is new since 2004-11-15.
dgpplain2004-12-03 03:36:15
Logged In: YES 
user_id=80530

leak is new since 2004-11-28.
dgpplain2004-12-03 03:55:08
Logged In: YES 
user_id=80530

Ignore those comments.

Appears the failed test doesn't
show up on Solaris ?
dgpplain2004-12-03 04:16:08
Logged In: YES 
user_id=80530

ok, on a better test platform,
confirmed the leak started
between 2004-11-30 and
2004-12-01.  very likely a
problem in my commit.
dgpplain2004-12-03 04:25:37
Logged In: YES 
user_id=80530

leak is rooted in the
post-script-evaluation
portion of Tcl_Init.
dgpplain2004-12-03 04:35:55
Logged In: YES 
user_id=80530


leak happens in the call to
TclpGetEncodingNameFromEnvironment()
dgpplain2004-12-03 05:33:27
Logged In: YES 
user_id=80530

leak happens in the
Tcl_GetEncoding() call
that returns NULL.
dgpplain2004-12-03 06:24:58
Logged In: YES 
user_id=80530

Leak is in MakeFileMap()
in tclEncoding.c

root cause was confusion about the
refCounting of Tcl_Obj's returned
by TclPathPart().

Committing fix...

thanks to the reporters and testers.
Log in (anonymous is fine) to add a comment.