Discussion:
[ast-developers] ksh: two memory leaks
Michal Hlavinka
2013-07-09 16:42:02 UTC
Permalink
Hi,

we found two memory leaks in ksh.

1) first one is related to an alias.
### set up
alias ls='/bin/ls -ltr'
### and call it in a loop
a=`ls some_file_that_does_not_exist 2>/dev/null`

as a result, ksh eats more and more memory

2) second one is related to autoloaded functions
### set up
cat >test48_autoload <<EOF
#!/bin/ksh

function test48_autoload
{
echo "function call"
}
EOF

FPATH=.
autoload test48_autoload

### and call it in a loop
a=`test48_autoload`

again, ksh eats more and more memory.

Complete reproducers are attached.

Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reproducer1.sh
Type: application/x-shellscript
Size: 317 bytes
Desc: not available
URL: <http://lists.research.att.com/pipermail/ast-developers/attachments/20130709/705175c9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reproducer3.sh
Type: application/x-shellscript
Size: 395 bytes
Desc: not available
URL: <http://lists.research.att.com/pipermail/ast-developers/attachments/20130709/705175c9/attachment-0001.bin>
Michal Hlavinka
2013-07-09 17:07:15 UTC
Permalink
Post by Michal Hlavinka
Hi,
we found two memory leaks in ksh.
1) first one is related to an alias.
### set up
alias ls='/bin/ls -ltr'
### and call it in a loop
a=`ls some_file_that_does_not_exist 2>/dev/null`
Nonexisting file is not required for reproducer, it's just much faster
than using ls or ls *
Post by Michal Hlavinka
as a result, ksh eats more and more memory
2) second one is related to autoloaded functions
### set up
cat >test48_autoload <<EOF
#!/bin/ksh
function test48_autoload
{
echo "function call"
}
EOF
FPATH=.
autoload test48_autoload
### and call it in a loop
a=`test48_autoload`
again, ksh eats more and more memory.
Complete reproducers are attached.
Michal
_______________________________________________
ast-developers mailing list
ast-developers at lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-developers
Loading...