Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
top command showing too much swap usage by several processes but the system hasn't such swap memory installed in it. So why it is showing such huge usage in top?
Page fault handling ALWAYS goes on. When memory pressure gets high enough code pages will get dropped, and reloaded as neccessary. The code pages come from the binary executable file but are nearly always loaded via page faults, and this can/will show up as "swapping" activity.
It is possible that you have some (maybe, relatively inactive ...) processes which have memory leaks. Since all user-land memory is virtual, this becomes occupied space in swap. The application is no longer referencing the "leaked" memory, so it eventually gets swapped out, but the application's total virtual-memory allocation continues to grow.
If an application's total VM-space continues to grow, but its so-called "working-set size" (the number of pages that must be in-RAM for the process to run efficiently) generally does not, "you probably have a 'leaker' on your hands."
This is a bug in the program. Or, in the case of a server, it might be a bug in one of the client programs.
Since most programs these days are written using languages which provide a "mark-and-sweep garbage collector," the most common cause of leaks is "circular storage references." A block of memory won't be deallocated until there are no remaining references to it. But, consider the case where there are two objects, A and B, and each contains a ("strong ...") reference to the other. Even if no one else is still referring to either object, the two objects continue to refer to each other and therefore keep either of them from being reaped.
And to complete the thought: what you can do about it, in designing a program, is to use "weakened" references, which tells (the software's, not Linux's ...) memory manager that "you can break this link, if you need to." If, say, the reference from A to B is designated as "weak," the garbage collector might decide to break it. Now, B (say ...) has no remaining "strong" references to it, so B can be reaped, and since that (say) means that A now has no remaining "strong" reference to it, A is reaped also, and the leak does not occur.
Mind you, these are programming language issues ... they are bugs. Linux isn't doing the wrong thing. The programs need to be fixed.
Last edited by sundialsvcs; 06-24-2016 at 07:49 AM.
Distribution: debian 9.8 w/GNOME and KDE dual boot w/Win 10.| debian 7.11 w/Xfce, LFS 7.9, + Multi-boot w/Windows7
Posts: 122
Rep:
Just to add something that may help.
Remember Linux is not Windows. It normally loads much into memory, using that resource to its advantage.
It will then quickly swap out or just clear space if there is no place to swap the memory resident code,
on demand, when another process needs that space.
If there is no swap configured as you seem to indicate, no wonder,right?
Why run without any swap? Swap does not need to be a dedicated partition. You can have a swap file.
Hope that helps,
Tim
Last edited by Tim Abracadabra; 07-07-2016 at 10:28 PM.
Reason: edit to add alternatives
Well, Linux is very aggressive in its use of buffers, but the accumulation of data in swap implies, to me, the presence of memory that has been allocated by an application program, but then never again referenced. Eventually, the data gets pushed out to the swap file, never to be called-back again because it was "caused by a leak."
The "amount of virtual memory used" by the suspect process will also be "steadily increasing," although the working-set size may not be large at all.
Last edited by sundialsvcs; 07-08-2016 at 11:52 AM.
Remember Linux is not Windows. It normally loads much into memory, using that resource to its advantage.
It will then quickly swap out or just clear space if there is no place to swap the memory resident code,
on demand, when another process needs that space.
If there is no swap configured as you seem to indicate, no wonder,right?
Why run without any swap? Swap does not need to be a dedicated partition. You can have a swap file.
Hope that helps,
Tim
Not exactly.
Linux uses swap to load executable code. If the code is sleeping, it will release those pages for other use, and when they DO become active, the pages are recalled via swap activity.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.