ksh memory leak

Solution Unverified - Updated -

Issue

  • Ksh leaks memory when it is running scripts.
  • There are three types of action that causes memory leak.
  • case1: Nested command substitutions
    Memory leak was fixed in ksh-20120801-1.el6 or later.
#!/bin/ksh

pmap -x $$ |tail -1
### case 1###
#nested comannd subsititustions
while :; do
    a=`expr 1 + \`expr 1 + 1\``
    pmap -x $$ |tail -1
done
  • case2: alias
#!/bin/ksh

###case 2###
#alias
alias ls='ls -ltr'

while :; do
    a=`ls`
    pmap -x $$ |tail -1
done
  • case3: function call via autoload
#!/usr/bin/ksh

function func1
{
    echo "func1 call";
}

#!/bin/ksh

###case 3###
#function call via autoload
FPATH=.
autoload func1

while :; do
    a=`func1`
    pmap -x $$ |tail -1
done

Environment

  • Red Hat Enterprise Linux 6.3
  • ksh-20100621-19.el6_4.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.