Re: Why would top show the processes are using swap when there is no swap space?



"jinzishuai@xxxxxxxxx" <jinzishuai@xxxxxxxxx> wrote:
Thank you both.
I am 100% sure that there is no swap space used. The /proc/swaps file
is empty and free shows 0 for swap also.

I think Floyd's idea about the code may be the case.
There are times that when I recompiled the running code, the running
code crashed.
This shouldn't happen if the whole code is loaded into the RAM at the
beginning.
But if it is as described "swapped out", then deleting the binary file
on disk would make the swap in impossible and thus I got a crash.
Thank you very much.

As Bill Marcum points out, the file will not actually be removed
and the disk space freed until all references to it are closed.

However, recompiling it and replacing it with a different binary
can indeed have the effect you are describing. I'm not sure
exactly how it works, because the compiler will (or used) refuse
to overwrite the old binary, stating that it was "busy".
However, when the binary is overwritten using cp, install, or
some other mechanisms it appears that it can happen.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@xxxxxxxxxx
.



Relevant Pages

  • Re: excessive swap-in time
    ... Trying to do it all with RAM is just inefficient. ... I find that does not work well when the swapping is caused by excessive I/O ... Or you could have 5 TB of swap space. ...
    (comp.os.linux.development.system)
  • Summary swap rules.
    ... So it looks as if swap is mostly not used anymore and can be kept pretty ... Tim Bradshaw stated what I privately felt- that 1:1 swap to memory is ... so it's really only around for memory leaks and core dumps. ... think) which are written to swap space. ...
    (SunManagers)
  • Re: malloc does not return null when out of memory
    ... >> actual RAM and swap are exhausted. ... Having actually worked on the IRIX VM system, and on vswap ... Adding Virtual Swap Space ... You can create a normal file of larger than 0 length and allocate it as ...
    (freebsd-stable)
  • RE: Where do you put your swap partition?
    ... so I can mount /tmp on a tmpfs file system. ... it, hits the disk several times, even with a large buffer cache. ... don't have enough ram, you have to swap, but you're no worse off than ... disk and /var on a third, and have swap space defined on all three. ...
    (Debian-User)
  • Re: Is Greenspun enough?
    ... the swap copy can be liberated. ... This means that whatever swap space you configure nicely ... If you have a gigabyte of RAM, ... >gigabyte VM with one gigabyte of RAM, you need two gigabytes of disk ...
    (comp.lang.lisp)