I tell my students that kill -9 is evil and to not use it (except when everything else fails). Kill -9 cannot be handled in the program, it kills the program immediately leaving open files, memory allocations, swap space, and all kinds of other stuff like child processes laying around. You are correct to use -15 (the default for kill pid). If that does not work then kill -2 (quit with a core dump), or sometimes in the case of shells running scripts you need kill -1 (better to use kill -HUP here so you do not accidentally kill 1).
On Sun, Aug 28, 2022 at 12:58 PM American Citizen <[email protected]> wrote: > To all: > > Regarding recovering both memory and swap space, after killing an > algebraic program, I restarted the system, rand some of these types of > programs, then reached a point where I had to shut the system down, so I > tried using the kill -15 command to kill the running algebraic programs, > and then both physical memory and swap space were released. I was using > kill -9 in the past, but now I will use kill -15 as it does what I > expected. > > Also I found out a great CLI command to see what's in swap memory, > called "smem" and you can sort processes using swap by the simple command > > % smem -s swap -r > > very useful command to know. > > I am not sure why kill -9 left stuff sitting around. (at least on my > machine) > > Randall > > >
