From owner-freebsd-stable@FreeBSD.ORG Wed Jul 26 11:56:58 2006 Return-Path: X-Original-To: stable@freebsd.org Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 96AD616A4DA for ; Wed, 26 Jul 2006 11:56:58 +0000 (UTC) (envelope-from sdupille@nospam.fr.eu.org) Received: from mail.nospam.fr.eu.org (galadriel.nospam.fr.eu.org [88.191.16.109]) by mx1.FreeBSD.org (Postfix) with ESMTP id 37BEF43D53 for ; Wed, 26 Jul 2006 11:56:57 +0000 (GMT) (envelope-from sdupille@nospam.fr.eu.org) Received: by mail.nospam.fr.eu.org (Postfix, from userid 2001) id 3AE09440813; Wed, 26 Jul 2006 13:56:56 +0200 (CEST) From: Stephane Dupille To: stable@freebsd.org References: <20060726113412.GE740@turion.vk2pj.dyndns.org> Organization: Home Mail-copies-to: never Date: Wed, 26 Jul 2006 13:56:56 +0200 In-Reply-To: <20060726113412.GE740@turion.vk2pj.dyndns.org> (Peter Jeremy's message of "Wed, 26 Jul 2006 21:34:12 +1000") Message-ID: User-Agent: Gnus/5.090024 (Oort Gnus v0.24) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Cc: Subject: Re: Memory management X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2006 11:56:58 -0000 Peter Jeremy écrit : >> As time passing by, the memory fills up. When the machine starts, >>memory is occupied to 30 %, and after two or three weeks memory is >>occupied to 100 % and it begins to use swap. > How are you monitoring memory usage? Using top, mainly. And ps, swapinfo, vmstat... > Do you mean 'swap' or 'page'? swap. > A level of page-in's is normal because text and data areas for > processes are loaded by paging them in. OK for that, but when I have 700 MB of "inactive memory", and "free memory" reaching zero, the system begins to use the swap : swapinfo says that swap is used (paged out). Is that normal ? > Wired pages are pages that the kernel has wired to RAM so they cannot > be paged out. Active pages are being mapped by virtual memory and > in use by running processes. Inactive pages are not currently mapped > but the kernel knows their contents and can re-map them without > needing to retrieve them from disk - they may be dirty. Cache pages > are similar to active pages but aren't dirty and are higher-priority > candidates for being freed. Free pages have no useful content and > will be used to fulfil page-in requests. OK, thanks for the definitions. Why there is two states "inactive" and "cache", if they are so similar ? (it's just curiosity, my questions have answers now.) > Yes. 'Free' memory is basically wasted and so the kernel tries to limit > it, subject to having sufficient free memory to meet page-faults. Most > of your RAM should be wired, active or inactive. Inactive memory will > start at 0 and grow as active pages are released. OK, sounds clear. >> What should I do ? > Nothing. Why do you think you have a problem? As long as I was not sure what "inactive" means, I was not sure of what to think. My first guess was that "inactive" memory are like "active" memory but was not accessed for some time, and as such have more priority to be pages out to swap than "active" memory. So i tried to search for the real definition of what "inactive" memory is, and what I found was a little bit fuzzy. >> Do you have any tools to monitor memory usage of processes ? > ps(1) ps(1) is ok to check snapshots of process states, but not the evolution of the memory usages. I looked for a tool mainly to find processes with memory leaks.