From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63740 invoked by alias); 17 Oct 2016 16:13:11 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 63724 invoked by uid 89); 17 Oct 2016 16:13:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.2 spammy=upset, malloch, UD:malloc.h, malloc.h X-HELO: mail-qk0-f179.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding; bh=rn6kCTeZ9BEcauhu2kHPPA2GzqS2OLndDyVmTMw2HGU=; b=j88LktVMZD1BGtzXaPxpw4ErG+OSz5b4dzS6Ui8zUDDg4OuE7KVYFM05HMQqIz9/SJ 9BuyP80izKrS8E/HZAm8KIyTs127fHEMijLiEKRbmGCUH2ezs/AgF3rWdXOQt5p5qi16 YXfddIVqiC9PjzXLW7aDKRQx2BsWRzUkmouf9YTENkzJlnMAzYHf+LilKdpPwEAlxrHO 5MNGdSohAnUwXV7Sj0TkQ0B3VgXcmkuR1rm34rD2fIVNWjrTtUO2B16dG4bMXOm28qLQ yyeNpxgcJQ6ZlxBdStDydEvlcTWONihB2DgPbEHKKRGGxKzHZL5nDDQHhZjfII9okbOT 5I9g== X-Gm-Message-State: AA6/9Rk9Vcb8MvZiwYGxbhl7MbpU2jJL+tO79tQ+bPvp3ih9cvNpiJRyuvpje2EXgwRRfuhz X-Received: by 10.55.23.90 with SMTP id i87mr23831870qkh.226.1476720787155; Mon, 17 Oct 2016 09:13:07 -0700 (PDT) Subject: Re: [PATCH 1/2] Add note on MALLOC_MMAP_* environment variables To: Siddhesh Poyarekar , libc-alpha@sourceware.org References: <1476120388-26662-1-git-send-email-siddhesh@sourceware.org> From: Carlos O'Donell Message-ID: <013af3b4-a6db-dd01-9adf-028ba53daf00@redhat.com> Date: Mon, 17 Oct 2016 16:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1476120388-26662-1-git-send-email-siddhesh@sourceware.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-10/txt/msg00270.txt.bz2 On 10/10/2016 01:26 PM, Siddhesh Poyarekar wrote: > The mallopt parameters manual does not mention the environment > variables that can be used to set these parameters at program startup. > Mention those environment variables for completeness. Please don't get upset with me :-) I'm asking you to document the default for these env var tunables. I think it's valid for users to want to know what value they would have had if they _didn't_ set the environment variable. Throwing our hands up in the air and saying "it's implementation defined" isn't very useful IMO. > * manual/memory.texi: Add environment variable alternatives to > setting mallopt parameters. > --- > manual/memory.texi | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/manual/memory.texi b/manual/memory.texi > index 5383105..222f126 100644 > --- a/manual/memory.texi > +++ b/manual/memory.texi > @@ -1113,12 +1113,18 @@ choices for @var{param}, as defined in @file{malloc.h}, are: > @item M_MMAP_MAX > The maximum number of chunks to allocate with @code{mmap}. Setting this > to zero disables all use of @code{mmap}. > + > +This parameter can also be set for the process at startup by setting the > +environment variable @code{MALLOC_MMAP_MAX_} to the desired value. What's the default? > @item M_MMAP_THRESHOLD > All chunks larger than this value are allocated outside the normal > heap, using the @code{mmap} system call. This way it is guaranteed > that the memory for these chunks can be returned to the system on > @code{free}. Note that requests smaller than this threshold might still > be allocated via @code{mmap}. > + > +This parameter can also be set for the process at startup by setting the > +environment variable @code{MALLOC_MMAP_THRESHOLD_} to the desired value. What's the default? > @comment TODO: @item M_MXFAST > @item M_PERTURB > If non-zero, memory blocks are filled with values depending on some > @@ -1128,16 +1134,25 @@ use of uninitialized or freed heap memory. Note that this option does not > guarantee that the freed block will have any specific values. It only > guarantees that the content the block had before it was freed will be > overwritten. > + > +This parameter can also be set for the process at startup by setting the > +environment variable @code{MALLOC_MMAP_PERTURB_} to the desired value. What is the default? > @item M_TOP_PAD > This parameter determines the amount of extra memory to obtain from the > system when a call to @code{sbrk} is required. It also specifies the > number of bytes to retain when shrinking the heap by calling @code{sbrk} > with a negative argument. This provides the necessary hysteresis in > heap size such that excessive amounts of system calls can be avoided. > + > +This parameter can also be set for the process at startup by setting the > +environment variable @code{MALLOC_TOP_PAD_} to the desired value. What's the default? > @item M_TRIM_THRESHOLD > This is the minimum size (in bytes) of the top-most, releasable chunk > that will cause @code{sbrk} to be called with a negative argument in > order to return memory to the system. > + > +This parameter can also be set for the process at startup by setting the > +environment variable @code{MALLOC_TRIM_THRESHOLD_} to the desired value. What's the default? Note: There is a limit even with dynamic trim threshold on. This disables the dynamic trim threshold, and that's a very important thing to mention. > @end table > > @end deftypefun > -- Cheers, Carlos.