From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27289 invoked from network); 17 Aug 2020 20:34:59 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 17 Aug 2020 20:34:59 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id DF3D89E1AF; Tue, 18 Aug 2020 06:34:54 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id CC76B9E186; Tue, 18 Aug 2020 06:34:23 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Ee5PkuUr"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 574349CAB3; Tue, 18 Aug 2020 06:34:20 +1000 (AEST) Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) by minnie.tuhs.org (Postfix) with ESMTPS id 64BA29C8BB for ; Tue, 18 Aug 2020 06:34:19 +1000 (AEST) Received: by mail-vs1-f44.google.com with SMTP id y8so8965809vsq.8 for ; Mon, 17 Aug 2020 13:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=1NWGNNzRC0OtgStrXXRJ0smgo63McCYvtl/7R3VybPQ=; b=Ee5PkuUr40T9xegjF6EC6hovtq5Xg5lNoAYLqbrkxeSTDRe3hP30GPvlFrypCoNCfL zg82jwnZzKlTqeqdNoDX1ukp+eD8bRisOQf5ALtdFp32QrcfQ5ussYyg+2e3rciBKd8f XFAZVswURaamFBpiDDQ2f4kkRV0osvpTJFJIh5IbJRG4P7sfxYukoZ3CN6orboAqGUsi pun1F2hn7u7Ye0CCbkAbZPnAyoXwkdGF0qsFx1y+xiT5uOwUnB9RWfLXBbkKXXUXuM/j t++ijr5517mWKtzoGqJ/4wUjhW1586kEeDSqGwOiZ1m1U1jKFoPJdSnct2XLNlVEtkKy iiZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1NWGNNzRC0OtgStrXXRJ0smgo63McCYvtl/7R3VybPQ=; b=GFbjqJt8NJ7QENg+6nJFSwccMsZzVG7pe8LFgR5VWreOfRYF/aW901jVOp3YrBMxpO LyBlmFxFXXHvmxTPutTTWz90O52/lcCn/VeOyslWLVspRm1ZyNAB/kBcsTUxu2pEo6Ka V5AZKgA4qMX5KJaJhCUvd9tgyXSK6WZFRJbsFHrlQqgz9+phaO3iwc3x+IXDX/7FyVoU eAya1p7bxPcvqR2d4Vy6f4SCgg+Qkj9l2SffuNj88tsIq1aZMBLNVy18NJFQKCRvKZfq 2sJAmJroB6plu+EcNoZBC6Tt4DXSXY1A98YRGlGQIRfshpF7CYCurhB0AbRwt9/HGVI+ Q9lg== X-Gm-Message-State: AOAM532FD1VzBW6Hb1hfidNvsdPs13iSZAvYYnjHM2ynvtS+4gAmK1l2 YWzQv+IXy7RjKHjsFJwdGSjS4/+MqQhLfL5sOnE= X-Google-Smtp-Source: ABdhPJz0lupPllPsywJCRVOqJETL0e09wzLNNzLFWu4xQQ881n/+19SrW7JXR9ktDAHFxXbOaHMUarU6yUVlcDUwmuM= X-Received: by 2002:a67:68d2:: with SMTP id d201mr9487610vsc.186.1597696457914; Mon, 17 Aug 2020 13:34:17 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:48e9:0:0:0:0:0 with HTTP; Mon, 17 Aug 2020 13:34:17 -0700 (PDT) In-Reply-To: References: From: Paul Winalski Date: Mon, 17 Aug 2020 16:34:17 -0400 Message-ID: To: Dibyendu Majumdar Content-Type: text/plain; charset="UTF-8" Subject: Re: [TUHS] Memory management in Dennis Ritchie's C Compiler X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: The TUHS Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" On 8/17/20, Dibyendu Majumdar wrote: > > Yes, it only uses sbrk(). One consequence I think is that sbrk() > expands the process memory without invalidating existing use of memory > - so the code is able to periodically expand heap while retaining all > existing allocations. If everyone does that, you can call other people's code without fear of stepping on their memory when you allocate memory in your code. Using a negative value to decrease the break is more problematic. malloc() usually uses sbrk() to extend its heap. When we ported DEC's GEM compilation system to Unix, I used sbrk() to extend memory and built my own multiple heap allocation scheme on top of that. I could have used malloc() to allocate the heap chunks, but there was no point. Might as well cut out the middleman. -Paul W.