From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 9 19:32:18 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF5D5106566C for ; Thu, 9 Jun 2011 19:32:18 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6238C8FC0A for ; Thu, 9 Jun 2011 19:32:17 +0000 (UTC) Received: by eyg7 with SMTP id 7so946507eyg.13 for ; Thu, 09 Jun 2011 12:32:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=OrkQmwImWXh18m1TNKLlKgWZ7lLko1u1AlqkmigFNEM=; b=JeSq8kjMd2KE4ni9ivNjnXvkHLXEddLu+7nroCEZM+DTWmxCNI7SkGHn1Ww6dwSFgr pbjHDyb3RoKMhcVc2UifEJ+HDlD6DRPsLGIweDQU2rGl5n/U4iTflPIATLtZTsSfIhFz /t1XYhY9RVoGxD/zTZqS1uxn+IEVLKdLEYxdU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=EWGBSEWM8bzI7aV5NzW5EELxqAqWaUbpffxSR/rGRD26sgZODp2GRbeX1jYM2vYza5 i7KR2i/EDY+stmI9B5NovRsdrSJsBx1rkpvq6DqIAZrJJGZlxf7NT7wvYa8CWQidSINr /Ek4OSDcR92vMhWGxf9pdE1SRRK+X2anYlGrE= MIME-Version: 1.0 Received: by 10.213.33.5 with SMTP id f5mr2772124ebd.82.1307646612923; Thu, 09 Jun 2011 12:10:12 -0700 (PDT) Received: by 10.213.26.17 with HTTP; Thu, 9 Jun 2011 12:10:12 -0700 (PDT) Date: Thu, 9 Jun 2011 15:10:12 -0400 Message-ID: From: Ryan Stone To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Large data segments interact poorly with MALLOC_OPTIONS=M X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jun 2011 19:32:18 -0000 At $(WORK) I've been porting our applications from FreeBSD 6 to FreeBSD 8. One of our daemons tends to be a big memory hog, so we set a data segment size of 1.5GB to accommodate it. This ends up breaking horribly now that malloc uses mmap to allocate memory by default. What happens is that malloc ends up exhausting all of the address space outside of the data segment first(with mmap) before using any of the data segment(with sbrk). Meanwhile, other users of mmap can only allocate address space outside of the data segment. This includes pthread_create, which allocates the thread's stack directly via mmap. Is the recommendation with jemalloc to make the data segment as small as possible, to avoid these types of issues?