Re: [PLUG] memory and swap not recovered after program kill - some questions
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 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 > > >
Re: [PLUG] memory and swap not recovered after program kill - some questions
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
Re: [PLUG] memory and swap not recovered after program kill - some questions
On Sat, Aug 27, 2022 at 7:50 PM Cy wrote: > On Sat, 27 Aug 2022 13:32:54 -0700 > American Citizen wrote: > > > Once I kill the algebraic > > program, shouldn't we see system memory recovered? > > That sounds a lot like the hard disk caching thing that Linux does. It > will save stuff > read from the hard disk into unused memory, so that if it's read a second > time, it will > come straight from RAM, without touching the disk. If any process actually > allocates > memory, that disk cache will be deleted transparently to free up memory > for it. > > Your problem might not be that, but I have heard of people noticing that > their memory was > still being "used" even though the programs had exited, and it turned out > that it was disk > caching, and Linux is kind of poorly designed, so they made it appear to > be used > memory, not unused memory or a special "disk cache" memory. > Uh, I'd take issue with "poorly designed". Maybe misunderstood. To increase understanding, look at something like this: https://www.golinuxcloud.com/tutorial-linux-memory-management-overview/ Free RAM is wasted RAM.