git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] sha1_file: fix delta_stack memory leak in unpack_entry
Date: Fri, 21 Feb 2014 00:41:48 -0500	[thread overview]
Message-ID: <20140221054148.GA24882@sigill.intra.peff.net> (raw)
In-Reply-To: <1392940067-4830-1-git-send-email-pclouds@gmail.com>

On Fri, Feb 21, 2014 at 06:47:47AM +0700, Nguyễn Thái Ngọc Duy wrote:

> This delta_stack array can grow to any length depending on the actual
> delta chain, but we forget to free it. Normally it does not matter
> because we use small_delta_stack[] from stack and small_delta_stack
> can hold 64-delta chains, more than standard --depth=50 in pack-objects.
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  Found when trying to see if making some objects loose at this phase
>  could help git-blame and how many objects will be loosened. Gotta go
>  soon, didn't really test it, but I bet it'll work.

This looks correct to me.

For fun, I measured "git fsck" on linux.git via massif. The peak memory
usage dropped from 368MB to 306MB. That's probably an extreme case
because it's a big repo and was packed with "--aggressive", but it's
still a nice improvement.

-Peff

  reply	other threads:[~2014-02-21  5:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 23:47 [PATCH] sha1_file: fix delta_stack memory leak in unpack_entry Nguyễn Thái Ngọc Duy
2014-02-21  5:41 ` Jeff King [this message]
2014-02-21 18:09   ` Junio C Hamano
2014-02-22  8:12     ` Jeff King
2014-02-22 15:44     ` Thomas Rast

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140221054148.GA24882@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).