linux下释放系统内存
2010-09-27 14:27:55| 分类:
Linux
| 标签:
|举报
|字号大中小 订阅
1.释放共享内存:
ipcs -m | awk '{if($2~/^[0-9]+$/)print $2}'
cat out | while
read shid
do
ipcrm shm $shid
done
2.释放内存:
sync
sync
sync
free -m
echo 1 >/proc/sys/vm/drop_caches
free-m
echo
0 >/proc/sys/vm/drop_caches
关于drop_caches的官方说明如下:
Writing
to this file causes the kernel to drop clean caches,dentries and inodes from
memory, causing that memory to becomefree.
To free pagecache, use echo 1
> /proc/sys/vm/drop_caches;
to free dentries and inodes, use echo 2
> /proc/sys/vm/drop_caches;
to free pagecache, dentries and inodes,
use echo 3 >/proc/sys/vm/drop_caches.
Because this is a
non-destructive operation and dirty objects are not freeable, the user should
run sync first.
评论这张
转发至微博
转发至微博
评论