How To
Summary
The ksh command will fail to allocate memory required for script variable if there is memory requirement in MB's and it fails with this error "“0403-029 There is not enough memory available now.” Any command or script that creates ksh variables with size in MB's might fail.
AIX offers KSH_STAK_SIZE environment variable to prevent this error and we have to export the environment variable with space to satisfy the needs of the script variable.
export KSH_STAK_SIZE=2MB.
If we export like this all script, that we are executing gets stack size 2MB, even if that is not required for them. We can solve this in two ways:
Objective
# cat 1.sh
#!/usr/bin/ksh
#export KSH_STAK_SIZE=2MB
./ksh_enomem.sh
rc=$?
exit $rc
(0) root @ fvtrain49-lp3: /
# ./1.sh
./ksh_enomem.sh[2]: 0403-029 There is not enough memory available now.
(1) root @ fvtrain49-lp3: /
# cat ksh_enomem.sh
#!/usr/bin/ksh
test=`cat ./test.out`
exit 0
(0) root @ fvtrain49-lp3: /
# cat 1.sh
#!/usr/bin/ksh
export KSH_STAK_SIZE=2MB
./ksh_enomem.sh
rc=$?
exit $rc
(0) root @ fvtrain49-lp3: /
# ./1.sh
(0) root @ fvtrain49-lp3: /
#
# set KSH_STAK_SIZE=2MB ksh_enomem.sh
(0)
Environment
Document Location
Worldwide
Was this topic helpful?
Document Information
Modified date:
06 September 2022
UID
ibm16606295