#1291 Memory leak in md5crypt::aprcrypt in tcllib 1.13

pending-invalid
md5crypt (2)
5
2011-11-10
2011-10-21
Rich
No

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.

Discussion

    • assigned_to: patthoyts --> andreas_kupries
     
  • 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

     
  • My test script

     
    Attachments
    • status: open --> pending-invalid