when I run pmap <pid>
It is giving me below list
00007f545bbc5000 1016K rw--- [ anon ]
00007f545bd0c000 76K r-x-- /opt/openmrs/.openmrs-lib-cache/bahmnimsf/org/bytedeco/javacpp/linux-x86_64/libjniswscale.so
00007f545bd1f000 2044K ----- /opt/openmrs/.openmrs-lib-cache/bahmnimsf/org/bytedeco/javacpp/linux-x86_64/libjniswscale.so
00007f545bf1e000 4K rw--- /opt/openmrs/.openmrs-lib-cache/bahmnimsf/org/bytedeco/javacpp/linux-x86_64/libjniswscale.so
00007f545c1bc000 52K r-x-- /opt/openmrs/.openmrs-lib-cache/bahmnimsf/org/bytedeco/javacpp/linux-x86_64/libjniswresample.so
00007f545c3ca000 12K ----- [ anon ]
00007f545c3cd000 1016K rw--- [ anon ]
00007f545c4cd000 2048K rw--- [ anon ]
00007f545c6cd000 12K ----- [ anon ]
00007f545c6d0000 1016K rw--- [ anon ]
00007f545c812000 1676K r--s- /opt/openmrs/lucene/indexes/org.openmrs.PersonAttribute/_1y_Lucene41_0.pos
00007f545c9b5000 108K r-x-- /opt/openmrs/.openmrs-lib-cache/bahmnimsf/org/bytedeco/javacpp/linux-x86_64/libswresample.so.2
00007f545cbd2000 12K ----- [ anon ]
00007f545cbd5000 1016K rw--- [ anon ]
I can see the details of one process when I runt the command. But,
Here [anon]
is taking some memory right. Can I free that memory?
Here I don't want to kill the process. Just want to free the memory from that process.
Thanks in advance
That depends on what you mean. Most likely, the answer is no because this is a list of memory consumptions of different parts of the given process. You typically have no influence over these parts. [ anon ]
just means that this part has no specific name which could be shown, so it is declared anonymous. (It could be the main program of the process as opposed to some library used within that process.)
Your only way of freeing that memory is to end the process, be it by urging it to terminate (maybe via a GUI) or by sending it a signal (e. g. via kill (1)
).
Any other way of freeing the memory from the outside (for which there is no interfaces in existence, but one might be able to do this using a debugger or similar) would mean to meddle in the affairs of the running process. That is not advisable. The process will sooner or later access the memory it allocated. If that isn't allocated anymore, it will be sent a SEGFAULT and consequently typically terminate.
That being said, it could be that you are considering changing the program to allocate less memory. In this case the question is way too broad and would rely heavily on the program you are looking at.