How to release hugepages from the crashed application
Sometimes need to check all directory that hugetlbfs has been mounted. So,
find mounted directory by command
mount | grep huge
.check every directory except especially
/dev/hugepages
.delete all 2M-sized files. (2M is the size of hugepage)
Use ipcs -m
to list the shared memory segments.
Use ipcrm
to remove the left over shared memory segments.
Edit on 06/24/2019: Ok, so, the above answer, while correct as far as it goes, was a bit brief. In particular, if you have a host with multiple DB instances, and only one is crashed how can you determine which (if any) memory segments should be cleaned up?
Well, this too, can be done. For each running instance, connect w/ / as sysdba
, then do oradebug setmypid
(any pid will do, as all Oracle PIDs connect to the SGA). Then do oradebug ipc
. That will (hopefully) return IPC information written to the trace file
. So, go to the udump (or diag_dest) directory, and look for your trace file. It will contain all the IPC information for the instance. This will include ShmId
. Look through the file for the ShmId(s) that this instance is using. Now look at the output of ipcs -m
.
When you have done that for all the running instances, any memory segment output by ipcs -m
that shows non-zero memory allocation, and that you cannot account for in the oradebug ipc
information from any running instance, must be the left over memory segments from the crashed instance. Use ipcrm
to remove it/them.
When doing this on a host with multiple running instances, this can be a bit fraught. Please proceed with caution. You don't want to remove the SGA of a running instance!
Hope that helps....