Ticket UUID: | 1710710 | |||
Title: | Memory leaks in unload.test | |||
Type: | Bug | Version: | obsolete: 8.5a6 | |
Submitter: | kennykb | Created on: | 2007-05-01 17:00:59 | |
Subsystem: | 40. Dynamic Loading | Assigned To: | msofer | |
Priority: | 8 | Severity: | ||
Status: | Closed | Last Modified: | 2007-09-09 06:38:07 | |
Resolution: | Fixed | Closed By: | msofer | |
Closed on: | 2007-09-08 23:38:07 | |||
Description: |
Running valgrind on the Tcl test suite reveals numerous memory leaks in unload.test. They appear to be the loaded module failing to clean up after itself; since programmers are likely to use its code as an example of writing an unloadable module, it should do a better job. valgrind log is attached. | |||
User Comments: |
msofer added on 2007-09-09 06:38:07:
Logged In: YES user_id=148712 Originator: NO That was only a partial fix - TclPtrSetVar is a hairy monster wrt to the new value, and it remains one after this change. Tcl_SetVar2 needs to manage the refCount properly. Reverting the old fix, replacing with new fix in HEAD, 8.4 already correct. dgp added on 2007-05-11 01:50:37: Logged In: YES user_id=80530 Originator: NO I suspect this needs a backport for 8.4.15 ? kennykb added on 2007-05-03 04:04:22: Logged In: YES user_id=99768 Originator: YES Verified that the leaks are plugged; leaving this open in case the maintainer wants to add tclTest.c code to exercise this path (without dltest, we'd never have seen it). msofer added on 2007-05-02 07:32:54: Logged In: YES user_id=148712 Originator: NO There was indeed a refCount bug as mistachkin described; fix committed. mistachkin added on 2007-05-02 06:03:57: Logged In: YES user_id=113501 Originator: NO There does not seem to be any other place in the core that uses Tcl_SetVar2 with TCL_APPEND_VALUE. The only place I see using TCL_APPEND_VALUE is in tclExecute.c with TclPtrSetVar. Perhaps the string object allocated by Tcl_SetVar2 is always leaked if TCL_APPEND_VALUE is used? mistachkin added on 2007-05-02 05:45:59: Logged In: YES user_id=113501 Originator: NO The pkgua library is leaking the interpTokenMap hash table itself (by not calling Tcl_DeleteHashTable in PkguaFreeTokensHashTable); however, the Tcl_SetVar leaks appear to be false alarms. The memory being leaked is not owned by the package and the variables in question are not referred to by the package except to append values to them. kennykb added on 2007-05-02 00:00:59: File Added - 227376: leakunload.txt |
Attachments:
- leakunload.txt [download] added by kennykb on 2007-05-02 00:00:59. [details]