Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Major memory leak in methods

Closed / Duplicate3149691fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2011-01-02 12:00:09
WinXP Tcl8.6 TclOO 0.6.2.

memory leak in methods with variable declaration. Attached script gobbles 400MB memory from 1 object and never releases it. I expect it to use same amount of memory (after a few iterations).

console show ; update; package require TclOO 

oo::class create cell {
    method setcp1 {vv} {my variable cp1;set cp1 $vv}
}

set a [cell new] ;# create just one object!

set i 0;while {$i<6000000} {
    incr i;
    if {!($i%25000)} {puts "Looped $i times";update}
    $a setcp1 123
}
dkfplain2011-01-03 05:30:54
This artifact has been marked as a duplicate of artifact 3105999 with reason:
Identical symptom, not present on HEAD
dkf Closed ticket [3149691fff]. [History diff]2011-01-03 05:30:55
dkf Ticket [3149691fff]: 2 changes [History diff]2011-01-03 05:31:32
dkf Ticket [3149691fff]: 2 changes [History diff]2011-01-03 05:31:56
dkfplain2011-01-03 05:34:31
BTW, I watched the process in a memory monitor when it was running the sample code, and it was utterly flat in its memory consumption through the first million iterations. Even a single-byte leak (vanishingly unlikely) would have showed. Even a 10kB leak over the whole run would have showed. The leak's gone.
Log in (anonymous is fine) to add a comment.