1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

Enable some memory leak tests for standard malloc (re: 05683ec7) (#311)

The memory leak regression tests added in commit 05683ec7 only leak memory
in the C.UTF-8 locale if ksh is compiled with vmalloc. I've ran these
regression tests against ksh93v- and neither fail in that version of
ksh, which indicates the bug causing these tests to fail may be similar to
the one that causes <https://github.com/ksh93/ksh/issues/95>.
Since the memory leak tests work with -D_std_malloc, only set $LANG to
'C' if ksh is compiled with vmalloc enabled.
This commit is contained in:
Johnothan King 2021-05-20 16:51:54 -07:00 committed by Martijn Dekker
parent 0dd115e4b4
commit eca92ea48c

View file

@ -29,6 +29,7 @@ if builtin vmstate 2>/dev/null &&
then N=512 # number of iterations for each test then N=512 # number of iterations for each test
unit=bytes unit=bytes
tolerance=$((4*N)) # tolerate 4 bytes per iteration to account for vmalloc artefacts tolerance=$((4*N)) # tolerate 4 bytes per iteration to account for vmalloc artefacts
vmalloc=enabled
function getmem function getmem
{ {
vmstate --format='%(busy_size)u' vmstate --format='%(busy_size)u'
@ -253,8 +254,9 @@ err_exit_if_leak 'script sourced in virtual subshell'
# Multiple leaks when using arrays in functions (Red Hat #921455) # Multiple leaks when using arrays in functions (Red Hat #921455)
# Fix based on: https://src.fedoraproject.org/rpms/ksh/blob/642af4d6/f/ksh-20120801-memlik.patch # Fix based on: https://src.fedoraproject.org/rpms/ksh/blob/642af4d6/f/ksh-20120801-memlik.patch
# TODO: both of these tests still leak (although much less after the patch) when run in a non-C locale. # TODO: When ksh is compiled with vmalloc, both of these tests still leak (although much less
saveLANG=$LANG; LANG=C # comment out to test remaining leak (1/2) # after the patch) when run in a non-C locale.
[[ $vmalloc == enabled ]] && saveLANG=$LANG && LANG=C # comment out to test remaining leak (1/2)
function _hash function _hash
{ {
@ -282,7 +284,7 @@ done
after=$(getmem) after=$(getmem)
err_exit_if_leak 'indexed array in function' err_exit_if_leak 'indexed array in function'
LANG=$saveLANG # comment out to test remaining leak (2/2) [[ $vmalloc == enabled ]] && LANG=$saveLANG # comment out to test remaining leak (2/2)
# ====== # ======
# Memory leak in typeset (Red Hat #1036470) # Memory leak in typeset (Red Hat #1036470)