From owner-freebsd-current@FreeBSD.ORG Sat Apr 28 18:29:08 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 86C831065670 for ; Sat, 28 Apr 2012 18:29:08 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from canonware.com (10140.x.rootbsd.net [204.109.63.53]) by mx1.freebsd.org (Postfix) with ESMTP id 62C2A8FC16 for ; Sat, 28 Apr 2012 18:29:08 +0000 (UTC) Received: from [192.168.168.8] (70-91-206-178-BusName-SFBA.hfc.comcastbusiness.net [70.91.206.178]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by canonware.com (Postfix) with ESMTPSA id 27FB928418; Sat, 28 Apr 2012 11:29:02 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Jason Evans In-Reply-To: <20120428150941.e0464900.ray@dlink.ua> Date: Sat, 28 Apr 2012 11:29:01 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20120421185402.GH1743@albert.catwhisker.org> <7AD8956D-AD18-4CAB-9953-06E00185A7DA@freebsd.org> <20120428150941.e0464900.ray@dlink.ua> To: Aleksandr Rybalko X-Mailer: Apple Mail (2.1084) Cc: current@freebsd.org Subject: Re: : jemalloc_arena.c:182: Failed assertion: "p[i] == 0" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Apr 2012 18:29:08 -0000 On Apr 28, 2012, at 5:09 AM, Aleksandr Rybalko wrote: >>> On Apr 21, 2012, at 11:54 AM, David Wolfskill wrote: >>>>=20 >>>> But contrib/jemalloc/src/arena.c contains a function, >>>> arena_chunk_validate_zeroed(): >>>>=20 >>>> 175 static inline void >>>> 176 arena_chunk_validate_zeroed(arena_chunk_t *chunk, size_t >>>> run_ind) 177 { >>>> 178 size_t i; >>>> 179 UNUSED size_t *p =3D (size_t *)((uintptr_t)chunk + >>>> (run_ind << LG_PAGE)); 180 >>>> 181 for (i =3D 0; i < PAGE / sizeof(size_t); i++) >>>> 182 assert(p[i] =3D=3D 0); >>>> 183 } >=20 > maybe it somehow related to low count of free memory, because I see > that very frequently on my box. (Atheros AR7242 mips32be with 32M of > RAM) >=20 > After "#ifdef" of that function body, box behave good (seems) :) Yes, arena_chunk_validate_zeroed() (which is debug-only code) has the = side effect of faulting in untouched pages, so it potentially increases = physical memory usage. In practice, this sanity checking has saved = jemalloc from regressions that would otherwise manifest as mysterious = application memory corruption (and would have prevented even more = regressions, had it existed earlier). You can disable it and many other = performance-sacrificing debug features by defining MALLOC_PRODUCTION in = /etc/make.conf. Jason=