From owner-freebsd-questions@FreeBSD.ORG Wed Dec 10 17:06:23 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 C32451065675 for ; Wed, 10 Dec 2008 17:06:23 +0000 (UTC) (envelope-from Robert.Hell@fabasoft.com) Received: from fabaglexfr.fabasoft.com (fabaglexfr.fabasoft.com [192.84.221.196]) by mx1.freebsd.org (Postfix) with ESMTP id 0C7328FC17 for ; Wed, 10 Dec 2008 17:06:22 +0000 (UTC) (envelope-from Robert.Hell@fabasoft.com) Received: from FABAMAIL.fabagl.fabasoft.com ([10.10.5.136]) by fabaglexfr.fabasoft.com with InterScan Messaging Security Suite; Wed, 10 Dec 2008 17:35:35 +0100 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Wed, 10 Dec 2008 17:36:17 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: PostgreSQL on FreeBSD 7.0 amd64 with more than 2GB shared memory thread-index: Acla5WyD3d2avIxyTR2dOGDm7nhosw== From: "Hell, Robert" To: Subject: PostgreSQL on FreeBSD 7.0 amd64 with more than 2GB shared memory 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, 10 Dec 2008 17:06:23 -0000 Hi, I'm trying to run PostgreSQL 8.3 on a FreeBSD 7.0 amd64 server with more than 2GB shared memory. The machine has 32GB RAM installed. After setting kern.ipc.shmmax and kern.ipc.shmall to the appropriate values, I still had no chance to start postgres with more than 2GB of shared memory. I wrote a small test which does the same as postgres: shmget and shmat: #include #include #include #include int main() { int shmid, memKey =3D 1; void *memAddress; unsigned long size =3D 2147483648UL; shmid =3D shmget(memKey, size, IPC_CREAT | IPC_EXCL); if (shmid < 0) { printf("shmget failed: %d\n", errno); return 1; } memAddress =3D shmat(shmid, NULL, 0); if (memAddress =3D=3D (void *) -1) { printf("shmat failed: %d\n", errno); } return 0; } I found out that shmget failed with ENOMEM in shmget_allocate_segment (sysv_shm.c) because of an overflow of size (requested shared memory in bytes): int i, segnum, shmid, size; ... size =3D round_page(uap->size); if (shm_committed + btoc(size) > shminfo.shmall) { return (ENOMEM); } When changing size to an unsigned long shmget works - but now shmat then fails again with ENOMEM. Is there any easy way to use a shared memory segment which is larger than 2GB? Kind regards, Robert