Developer Data Modeling Mistakes: From Postgres to NoSQL
Clear cache memory
1. Clear Memory Cache on Ubuntu
I'am use backtrack 5 R2 linux operating system, sometime my computer often find my memory full
using process and services system. Here I will share trick to make efficient memory management
system with clear memory, as like other article almost the same for the script using. My computer
specification version detail as below :
root@bt:/opt/nessus/sbin# lscpu
Architecture: i686
CPU op-mode(s): 64-bit
CPU(s): 2
Thread(s) per core: 1
Core(s) per socket: 2
CPU socket(s): 1
Vendor ID: AuthenticAMD
CPU family: 20
Model: 2
Stepping: 0
CPU MHz: 780.000
Virtualization: AMD-V
L1d cache: 32K
L1i cache: 32K
L2 cache: 512K
And details using kernel Linux bt 2.6.39.4 / i686 GNU/Linux.
Show Memory Process
the computer has memory process are running on operating system, we can check using some
command the following :
counting total service on system :
root@bt:service --status-all | wc -l
[ ? ] vboxdrv
[ ? ] vboxweb-service
[ ? ] vmware-USBArbitrator
[ ? ] wpa-ifupdown
27
And information details process memory using command top are result as below :
top - 11:20:00 up 4:25, 6 users, load average: 0.26, 0.72, 0.81
Tasks: 177 total, 2 running, 173 sleeping, 0 stopped, 2 zombie
Cpu(s): 31.3%us, 7.8%sy, 1.8%ni, 57.3%id, 1.3%wa, 0.0%hi, 0.5%si, 0.0%st
Mem: 3612432k total, 3486996k used, 125436k free, 283264k buffers
Swap: 2353516k total, 548k used, 2352968k free, 1547248k cached
information peak memory usage :
root@bt:/usr/bin/time -v ls /
bin cdrom etc initrd.img lost+found mnt opt proc sbin share sys usr vmlinuz
boot dev home lib media NONE pentest root selinux srv tmp var
Command being timed: "ls /"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 50%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
Average shared text size (kbytes): 0
…..etc
2. Conky Monitoring
Conky is application to show information usage some
service system, RAM, hardisk and information
download and upload our connection. As bellow
picture are showing information RAM use 96%.
Script clear memory
create file name clear.cache on text editor and copy
this script.
#!/bin/sh
sh -c "sync; echo 3 >
/proc/sys/vm/drop_caches"
give file access to the file using comman chmod +x
(file clear.cache)
root@bt:~# chmod + clear.cache
Result Clear Cache memory
Now we trying running script :
root@bt:~# ./cache
root@bt:~#
and then we can show usage memory back to down.
Conclusion/opinion
Every Linux OS has an efficient memory
management system used to clear the buffer cache periodically. You can manually free up the memory
cache with the following simple
references :
http://www.linux.com
http://www.linuxtoday.com/
http://www.conky.sourceforge.net/
http://stackoverflow.com