From owner-freebsd-questions@FreeBSD.ORG Tue May 20 20:44:34 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7303A1065672 for ; Tue, 20 May 2008 20:44:34 +0000 (UTC) (envelope-from penoff@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.231]) by mx1.freebsd.org (Postfix) with ESMTP id 4F5F68FC1E for ; Tue, 20 May 2008 20:44:34 +0000 (UTC) (envelope-from penoff@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so2337288rvf.43 for ; Tue, 20 May 2008 13:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth; bh=RYJrj819xySXv56FscTxJPSAewi8qw4paXq6+NrjNLk=; b=SWcX48UHNA4ug2Rg2CN+pkiASUK/TrYdb0qACkJZ289JtDxvatRg7qruaK9Y1BrEW7jmeLnDxLcYfc8M6l7tANf3aDgNUUvZ3i4z7OFInpj+wwPwMG/Y1cHjKpcusFps3mzRGApJMua5D4AmRWfEJ9wJhRUIauTEiDcKm32SZ2I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth; b=hUwZW+8n0lssKkZtEehFGJ6nrEdcsLGpu/o/t9lDQzkL0rXRdNlAxAEc/A9iIJSgXLT7pU50+IiUkVOtXw5a5kj8w+NnuOPMynJ6Pwrs7cEijTbTQVKbrEGGDTb6YDLMgNwFTgPKLzq9xBhg4KF9A31JA14XqhSCZfrETj/Ms6E= Received: by 10.141.141.3 with SMTP id t3mr4670280rvn.226.1211314820858; Tue, 20 May 2008 13:20:20 -0700 (PDT) Received: by 10.140.135.16 with HTTP; Tue, 20 May 2008 13:20:20 -0700 (PDT) Message-ID: Date: Tue, 20 May 2008 13:20:20 -0700 From: "Brad Penoff" Sender: penoff@gmail.com To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: 1ee0259cb196d7fe Subject: resident memory limit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 May 2008 20:44:34 -0000 Greetings, I have an application that runs on Linux or Mac OS X but seems to have a problem when I run on FreeBSD (6.3 or 7). The issue is the memory footprint for the application (osubw_sctpclien below) is quite large; on Linux it can be as much as 950 MB in resident memory, according to top. However, on FreeBSD I start to get ENOMEM always around the time my resident memory size is about 200 MB. I read a few posts and have seen people fixing their problems by adjusting kern.maxdsiz in /boot/loader.conf and/or by adding a swap file. I've tried both and for my application, it still seems to be limited to 200 MB resident memory regardless of maxdsize and swap file setting. I wrote a toy application (malloctest below) that calls malloc in a while(1) and breaks once it gets ENOMEM (doing another while(1) so it doesn't exit); this application's memory size in top always matches the kern.maxdsiz setting, however it has a very low resident memory number, according to top. I have all the data below from these two applications. For malloctest, I can malloc as much as maxdsiz allows (without panic'ing the kernel). My main question is, in FreeBSD how can I increase the permitted resident memory of the system for my application to beyond 200 MB? Any ideas where this 200 MB resident memory limit is coming from? Why (in the last data entry below) does the resident memory limit become 80 MB after I increase maxdsiz AND use a swap file (the settings where malloctest can malloc the most!)? Thanks! brad Using FreeBSD 6.3..... kern.maxdsiz default setting ( 524288 kB ) no swap file. Mem: 218M Active, 9184K Inact, 36M Wired, 14M Buf, 1739M Free Swap: 512M Total, 512M Free PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND 978 root 4 118 0 203M 201M RUN 0:12 0.00% osubw_sctpclien ... separate run... 969 penoff 1 125 0 513M 1144K RUN 0:09 90.73% malloctest ------------------------------------------ kern.maxdsiz default setting ( 524288 kB ) 512 MB swap file. Mem: 218M Active, 9144K Inact, 36M Wired, 12K Cache, 14M Buf, 1739M Free Swap: 1024M Total, 1024M Free PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND 982 root 3 120 0 203M 201M RUN 0:13 0.00% osubw_sctpclien ... separate run... 967 penoff 1 126 0 513M 1144K RUN 0:10 94.60% malloctest ------------------------------------------ kern.maxdsiz="2147483648" # Set the max data size no swap file. Mem: 218M Active, 9168K Inact, 36M Wired, 14M Buf, 1739M Free Swap: 512M Total, 512M Free PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND 967 root 3 122 0 203M 201M RUN 0:31 0.00% osubw_sctpclien ... separate run... 980 root 1 129 0 2050M 2680K RUN 0:12 97.64% malloctest ---------------------------------------- kern.maxdsiz="2147483648" # Set the max data size 512 MB swap file. Mem: 220M Active, 12M Inact, 41M Wired, 12K Cache, 20M Buf, 1730M Free Swap: 1024M Total, 1024M Free PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND 1041 root 4 20 0 204M 202M kserel 0:04 0.00% osubw_sctpclien ... separate run... 967 root 1 121 0 2050M 2680K RUN 0:07 93.16% malloctest ---------------------------------------- kern.maxdsiz="3000000000" no swap file kernel panic ---------------------------------------- kern.maxdsiz="3000000000" # Set the max data size 512 MB swap file. Mem: 103M Active, 52M Inact, 106M Wired, 112M Buf, 1742M Free Swap: 1024M Total, 1024M Free PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND 15286 root 2 128 0 81172K 79080K RUN 1:47 0.00% osubw_sctpclien ... separate run... 963 penoff 1 122 0 2865M 3500K RUN 0:08 96.62% malloctest -----------------------------------------