How to Release Memory in Linux of Unused or Cached Objects
Hi Guys,
Many times we have seen that in our system there are lots of unused memory are used by the system but this memory are not usable because some garbage collection is occupying our memory in the system and the system is not able to release the memory. So I am writing some usable commands for releasing the memory of linux operating system which is very useful & easy.
Many times we have seen that in our system there are lots of unused memory are used by the system but this memory are not usable because some garbage collection is occupying our memory in the system and the system is not able to release the memory. So I am writing some usable commands for releasing the memory of linux operating system which is very useful & easy.
Memory Leakage happend when a computer
application or any process consumes required memory but unable to release the
memory after completing its task.There are two types of Memory Leakage in the
computer system one is Virtual Memory Leakage and another is Real Memory
Leakage.
|
||||||||||||||||||||
Now first we have to
checked the cached or unused memory first by executing the following
command on terminal.
|
||||||||||||||||||||
# free –m
|
||||||||||||||||||||
|
||||||||||||||||||||
Flush the file system
buffers by running the sync command,
|
||||||||||||||||||||
# sync
|
||||||||||||||||||||
Kernel provides a mechanism to drop the page
cache and/or inode and dentry caches on command,
which is helpful to free a lots of memory in the system.
|
||||||||||||||||||||
To free page cache use the below mention commands
on terminal:
|
||||||||||||||||||||
# echo 1 >
/proc/sys/vm/drop_caches
|
||||||||||||||||||||
To free dentries
and inodes:
|
||||||||||||||||||||
# echo 2 >
/proc/sys/vm/drop_caches
|
||||||||||||||||||||
To free page cache,
dentries and inodes:
|
||||||||||||||||||||
echo 3 > /proc/sys/vm/drop_caches
|
||||||||||||||||||||
These commands are
non-destructive and it will release unused memory only and will not affect any process of the system. As we have execute
the sync command so
it will remove the all unused Objects which are not free and used unused
memory.
Gud Luck....
Regards,
Sampan
|
Comments
Post a Comment