From owner-freebsd-questions@FreeBSD.ORG Wed Apr 30 00:37:13 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 70302106564A for ; Wed, 30 Apr 2008 00:37:13 +0000 (UTC) (envelope-from smallhand@crawblog.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.227]) by mx1.freebsd.org (Postfix) with ESMTP id 561AD8FC15 for ; Wed, 30 Apr 2008 00:37:13 +0000 (UTC) (envelope-from smallhand@crawblog.com) Received: by rv-out-0506.google.com with SMTP id b25so155226rvf.43 for ; Tue, 29 Apr 2008 17:37:13 -0700 (PDT) Received: by 10.141.198.9 with SMTP id a9mr34552rvq.219.1209515832647; Tue, 29 Apr 2008 17:37:12 -0700 (PDT) Received: by 10.141.78.7 with HTTP; Tue, 29 Apr 2008 17:37:12 -0700 (PDT) Message-ID: <919383240804291737k513360bcje6c4c85dc4621903@mail.gmail.com> Date: Tue, 29 Apr 2008 20:37:12 -0400 From: "Edward Ruggeri" To: "FreeBSD Questions" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Dynamic Memory Allocation 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: Wed, 30 Apr 2008 00:37:13 -0000 I have recently been writing an implementation of the sieve of Eratosthenes in C. To find all primes less than N, I dynamically create an array of chars (relatively small datatype) of length N+1 (I know I don't need to represent evens). Everything works great up until around 600 million, at which case memory allocation fails. At this point, I am asking for 600M chars, which is about 572MB (I might be failing to take account of offset?). My system has about 2GB of memory. Top says: Mem: 159M Active, 1113M Inact, 185M Wired, 56M Cache, 112M Buf, 481M Free. >From the man page, I am not completely clear what these values mean. However, I have read elsewhere that memory labeled as inactive should be available for the heap Is there a limit to how much memory may be allocated to a process? Any other reasons someone might think of? I am using FreeBSD 6.3-prerelease, with SMP for a Athlon X2 4200+ (if it makes a difference). Sorry if this is a RTFM question ... Sincerely, -- Ned Ruggeri