Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2009-05-05
04:33 • Closed ticket [2777803fff]: memory leak in ttrace plus 7 other changes artifact: 0099906de6 user: ferrieux
2009-04-21
19:44 • New ticket [2777803fff]. artifact: ab769edc39 user: melbardis

memory leak in ttrace

Closed / Invalid2777803fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2009-04-21 19:44:23
there appears to be a memory leak when sourcing ttrace.tcl.

namespace eval ttrace {
        ...
        variable mutex thread::mutex
        variable elock [$mutex create]
...}


the mutex elock is never released when the thread & interpreter are recycled (i am using websh).

i added a specific mutex destroy comand in the ttrace::cleanup procedure which solved the leak. but i don't think this is correct..

i am using the latest thread from the cvs repository, with changes to replace Tcl_Alloc with ckalloc...
ferrieuxplain2009-05-05 04:33:48
Mutexes and other sync primitives are opaque handles, not Tcl_Obj values, and are not managed through the usual Tcl-level refcounts. Hence the need for explicit [thread::mutex destroy] et al. So the cleanup procedure is actually the idiomatic way of doing it.
Log in (anonymous is fine) to add a comment.