Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Memory Leak, caused in Tcl_DeleteInterp

Closed1811706fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 18 years ago
Descriptionplain2007-10-11 17:04:55
Hey,

could you please take a look at the implementation of TCP_DeleteInterp?

It causes a memory leak of 34 bytes here,
if you wish i could post the valgrind leakcheck full!


Kind Regards
Daniel
[email protected]plain2007-10-12 00:06:28
Logged In: NO 

sorry, i was talking about TCL_DeleteInterp of course, and the Version where the problem occurs is 8.5b1.

Thank you!
msoferplain2007-10-12 00:15:58
Logged In: YES 
user_id=148712
Originator: NO

We may need to interact on this one ... please open a new ticket after logging in (so that you get auto email when the ticket is updated, and so that you can attach files if needed).

Please specify what script was being run, whether any C extensions are loaded in the interp, whether those are "definite" leaks or "still reachable", and the stack trace (10-deep is plenty) where the mem was allocated. Thank you.
msoferplain2007-10-12 00:21:24
Logged In: YES 
user_id=148712
Originator: NO

Ahhh ... is it this?

==15810== 156 (36 direct, 120 indirect) bytes in 1 blocks are definitely lost in loss record 1 of 4
==15810==    at 0x4021620: malloc (vg_replace_malloc.c:149)
==15810==    by 0x413D687: (within /lib/tls/i686/cmov/libc-2.5.so)
==15810==    by 0x413DED5: __nss_database_lookup (in /lib/tls/i686/cmov/libc-2.5.so)
==15810==    by 0x42E7EEB: ???
==15810==    by 0x42E905C: ???
==15810==    by 0x40EBE82: getpwuid_r (in /lib/tls/i686/cmov/libc-2.5.so)
==15810==    by 0x40EB867: getpwuid (in /lib/tls/i686/cmov/libc-2.5.so)
==15810==    by 0x81107AC: TclpGetPwUid (in /home/CVS/tcl_SF_clean/unix/tcltest)
==15810==    by 0x810FBBD: TclpSetVariables (in /home/CVS/tcl_SF_clean/unix/tcltest)
==15810==    by 0x8068DEA: Tcl_CreateInterp (in /home/CVS/tcl_SF_clean/unix/tcltest)
msofer Open ticket [1811706fff]. [History diff]2007-10-12 00:22:27
msofer Ticket [1811706fff]: 1 change [History diff]2007-10-12 00:23:28
[email protected]plain2007-10-12 00:34:54
Logged In: NO 

hey, i think so, that looks like it might be it.

Should I reopen a ticket with a signed up account?

If you want I can post my valgrind log as well!
nobodyplain2007-10-12 01:21:58
Logged In: NO 

I've tried with several tools to monitor for a leak, and looked at the code too.  I think this is probably either a bug in libc/glibc, or Valgrind.

I've tested this repeatedly and the process doesn't grow beyond a certain amount after a while.  I tested with single threaded, and --enable-threads builds of the Tcl HEAD from today.  I also can't duplicate the problem with the latest release of Valgrind.

/lib/libc.so.6 reports
GNU C Library stable release version 2.5

while 1 {
 interp create slave
 interp delete slave
}

-GPS
[email protected]plain2007-10-14 01:28:11
Logged In: NO 

Well I dont think that its a problem with GCC or Valgrind.

I have tried compiling the same thing on a windows machine, and checked for memory leaks with Boundschecker....Same result:

See this screenshot:
http://img99.imageshack.us/img99/3936/leaksw8.jpg
[email protected]plain2007-10-14 01:33:11
Logged In: NO 

...but for some reason the memory leak is 9KB+ on a windows machine, and not just 36 bytes :(
[email protected]plain2007-10-14 23:18:15
Logged In: NO 

i think I will have to fix them
im pulling the current HEAD and then I will close the leaks.

its very annoying and we really need to embed TCL in our application.


Daniel
msoferplain2008-01-12 20:25:59
Logged In: YES 
user_id=148712
Originator: NO

Daniel: any news on this? Did you find out where the problem is, and how to fix it?

The leak seems to be there at program exit, so it will be collected by the OS in the non-embedded case, as well as the case where the embedded interp dies at the end of the embedding program. It will be a problem if the embedding prog repeatedly initializes/terminates the embedded interp.
msofer Pending ticket [1811706fff]. [History diff]2008-06-28 20:48:01
sf-robotplain2008-07-13 09:20:22
Logged In: YES 
user_id=1312539
Originator: NO

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.