From owner-freebsd-questions@freebsd.org Sun Oct 9 01:33:56 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB70FBED3B3 for ; Sun, 9 Oct 2016 01:33:56 +0000 (UTC) (envelope-from doug@mail.sermon-archive.info) Received: from zoom.lafn.org (zoom.lafn.org [108.92.93.123]) by mx1.freebsd.org (Postfix) with ESMTP id 962A3AA2 for ; Sun, 9 Oct 2016 01:33:56 +0000 (UTC) (envelope-from doug@mail.sermon-archive.info) Received: from [10.0.1.4] (unknown [71.177.216.148]) by zoom.lafn.org (Postfix) with ESMTPSA id 8150F34ACF1 for ; Sat, 8 Oct 2016 18:33:48 -0700 (PDT) From: Doug Hardie Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) Subject: Re: Swap exhaustion Date: Sat, 8 Oct 2016 18:33:47 -0700 References: <1CD13C1C-5344-4909-A061-F25FBB86AFF9@lafn.org> To: FreeBSD - In-Reply-To: <1CD13C1C-5344-4909-A061-F25FBB86AFF9@lafn.org> Message-Id: <9DB5B54C-2AE4-4200-AB78-F86913E1E433@mail.sermon-archive.info> X-Mailer: Apple Mail (2.3226) X-Virus-Scanned: clamav-milter 0.98 at zoom.lafn.org X-Virus-Status: Clean X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2016 01:33:56 -0000 > On 27 May 2015, at 16:49, Doug Hardie wrote: >=20 > I have a process that is eating up 6 GB of swap space. At that point, = FreeBSD 9.3 terminates a process. However, occasionally its not the one = eating up the space. When I manually quit the process then the swap = space returns to a few KB used. The system runs fine after that. >=20 > I have very little knowledge of what this process is doing internally = but would like to know what might be causing this issue. There are 5 of = these processes running (parent plus 4 children). Normally each uses = about 90 MB RES/SIZE. However when the problem occurs they are about = 2GB RES/SIZE each. The system has 4 GB memory. I thought that a malloc = would not be able to grab that much memory, even with swapping as it has = to be in memory. Could a malloc cause this growth in process size or = need I look elsewhere? I have been trying periodically to resolve this issue. I modified the = application to log (syslog) every memory location it allocates. = Interestingly enough they are all around 0x100F380. However, the = segments that are increasing in number all have the highest order = address bit set, i.e., 0x83ac00000. These are shown by procstat as type = "df". The number of these increases with time. The sizes vary from = what appears to be small to over 5000 resident pages. They never seem = to go away unless I restart the process. Right after a restart there = are 7 "df"s. However, with time there can eventually be hundreds. = Since these do not have any file backing them, they eat up swap space = and thus cause the system to run out of swap and start killing = processes. What things allocate memory at the top of the address space? The = application mallocs and mmaps all allocate much lower in the address = space.