[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
memory leak in bash only during boot up in Bash-3.2.48
From: |
abhishpaliwal |
Subject: |
memory leak in bash only during boot up in Bash-3.2.48 |
Date: |
Tue, 18 Dec 2018 22:54:14 -0700 (MST) |
create a shell script from below given code. name it testing.sh.
#!/bin/bash
logger "Started testing"
while(true); do
while (true); do ls > /dev/null ; done
done
Steps.
# chmod 755 /root/testing.sh
modify any /etc/init.d/"service" file add "/root/testing.sh" inside the
start case.
"service" is any service file starting during start up.
Make sure above service is started during the startup.
Example :
Add testing to audit init script
start(){
echo -n "Starting testing.sh"
/root/testing.sh &
After boot up
root@localhost:/root> ps fax | grep testing
751 ? S 0:11 /bin/bash /root/testing.sh
9684 ttyS0 S+ 0:00 \_ grep testing
root@localhost:/root> cat /proc/751/smaps | grep -A10 heap
01419000-016ad000 rw-p 00000000 00:00 0 [heap]
Size: 2640 kB
Rss: 2536 kB
Pss: 2536 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 2536 kB
Referenced: 2536 kB
Swap: 0 kB
KernelPageSize: 4 kB
root@localhost:/root> cat /proc/751/smaps | grep -A10 heap
01419000-016ce000 rw-p 00000000 00:00 0 [heap]
Size: 2772 kB
Rss: 2740 kB
Pss: 2734 kB
Shared_Clean: 0 kB
Shared_Dirty: 12 kB
Private_Clean: 0 kB
Private_Dirty: 2728 kB
Referenced: 2740 kB
Swap: 0 kB
KernelPageSize: 4 kB
But when we are testing the same on Bash-4.4.0, its not consuming the memory
and steady as well, below are the logs
root@localhost:/root> ps fax | grep testing
964 ? S 0:02 /bin/bash /root/testing.sh
11484 pts/0 S+ 0:00 \_ grep testing
root@localhost:/root> cat /proc/964/smaps | grep -A10 heap
00b1b000-00b32000 rw-p 00000000 00:00 0
[heap]
Size: 92 kB
Rss: 88 kB
Pss: 88 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 88 kB
Referenced: 88 kB
Swap: 0 kB
KernelPageSize: 4 kB
root@localhost:/root> cat /proc/964/smaps | grep -A10 heap
00b1b000-00b32000 rw-p 00000000 00:00 0
[heap]
Size: 92 kB
Rss: 88 kB
Pss: 60 kB
Shared_Clean: 0 kB
Shared_Dirty: 56 kB
Private_Clean: 0 kB
Private_Dirty: 32 kB
Referenced: 88 kB
Swap: 0 kB
--
Sent from: http://gnu-bash.2382.n7.nabble.com/
- memory leak in bash only during boot up in Bash-3.2.48,
abhishpaliwal <=