From owner-freebsd-chat@FreeBSD.ORG Fri Nov 16 14:02:48 2007 Return-Path: Delivered-To: freebsd-chat@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF45D16A421 for ; Fri, 16 Nov 2007 14:02:48 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 7328D13C457 for ; Fri, 16 Nov 2007 14:02:47 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 810322085; Fri, 16 Nov 2007 14:47:26 +0100 (CET) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: -0.1/3.0 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on tim.des.no Received: from ds4.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id 728462083; Fri, 16 Nov 2007 14:47:26 +0100 (CET) Received: by ds4.des.no (Postfix, from userid 1001) id 559AE844A3; Fri, 16 Nov 2007 14:47:26 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: freebsd-chat@FreeBSD.ORG References: <200711160756.lAG7uGA1017136@lurza.secnetix.de> Date: Fri, 16 Nov 2007 14:47:26 +0100 In-Reply-To: <200711160756.lAG7uGA1017136@lurza.secnetix.de> (Oliver Fromme's message of "Fri\, 16 Nov 2007 08\:56\:16 +0100 \(CET\)") Message-ID: <861waql2tt.fsf@ds4.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: C out-of-bound pointer question X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Nov 2007 14:02:48 -0000 Oliver Fromme writes: > It is true that the k[] array in v2.0 uses 1 GB of mapped memory, > *BUT* it does not use 1 GB of RAM. It only uses one page of physical > RAM. Remember that RAM is allocated dynamically when it is accessed > for the first time, so if you never access k[0..268435409], then no > RAM will be allocated for it. Of course, you should make sure that it > is a local variable (or a malloc()ed one) that is not initialized, or > otherwise the initialization will cause RAM to be allocated. Make > sure you initialize only the indices that you need. It can't be a local variable; it's larger than the stack. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no