Tk Library Source Code

View Ticket
Login
Ticket UUID: 3427030
Title: Memory leak in md5crypt::aprcrypt in tcllib 1.13
Type: Bug Version: None
Submitter: rich123 Created on: 2011-10-21 21:49:15
Subsystem: md5crypt Assigned To: andreas_kupries
Priority: 5 Medium Severity: Minor
Status: Deleted Last Modified: 2013-05-31 19:25:20
Resolution: Not Applicable Here Closed By: aku
    Closed on: 2013-05-31 19:25:20
Description:
There is a memory leak somewhere in the md5crypt::aprcrypt implementation in tcllib
1.13.

Steps to repeat:

$ tclsh 
% parray tcl_platform
tcl_platform(byteOrder)   = littleEndian
tcl_platform(machine)     = i686
tcl_platform(os)          = Linux
tcl_platform(osVersion)   = 2.6.33
tcl_platform(platform)    = unix
tcl_platform(pointerSize) = 4
tcl_platform(user)        = work
tcl_platform(wordSize)    = 4
% puts $tcl_patchLevel
8.5.5
% package require md5crypt
1.1.0
% for {set i 0} {$i < 1000000} {incr i} { ::md5crypt::aprcrypt blah [ ::md5crypt::salt ] }

Watch memory usage of tclsh in top or another monitor.  It will grow over time as the for loop iterates.
User Comments: andreas_kupries added on 2011-11-11 05:41:14:

File Added - 428211: trial

andreas_kupries added on 2011-11-11 05:39:59:
I am unable to confirm this. Using a self-build Tcl 8.5.11 with memory debugging (--enable-symbols=all) and the attached modified test script I see the current and maximum allocations rock solid at their values, without any increase.

I tried this with pure-Tcl md5crypt, and md5crypt accelerated via tcllibc. The latter I ran to the full million, the former only to 1000 rounds, gives that it is much slower.

Output after completions:
% ../../../DTest/8.5/Install/Debug/bin/tclsh8.5 ./trial
8.5.11
1.1.0
*
1009:   m703050 834514^C

% ../../../DTest/8.5/Install/Debug/bin/tclsh8.5 ./trial
8.5.11
1.1.0
*       /home/aku/Projects/Tcllib/0.Releases/1.14/Base/modules/tcllibc/linux-x86_64/tcllibc.so Tcllibc
999999: m683191 750032

Attachments: