From: Junio C Hamano <gitster@pobox.com>
To: "Björn Steinbrink" <B.Steinbrink@gmx.de>
Cc: Avery Pennarun <apenwarr@gmail.com>,
Eric Wong <normalperson@yhbt.net>, Adam Roben <aroben@apple.com>,
Samuel Bronson <naesten@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH] git cat-file: Fix memory leak in batch mode
Date: Sat, 28 Jun 2008 20:36:46 -0700 [thread overview]
Message-ID: <7v1w2gkj3l.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080629012125.GA1722@atjola.homenet> (Björn Steinbrink's message of "Sun, 29 Jun 2008 03:21:25 +0200")
Björn Steinbrink <B.Steinbrink@gmx.de> writes:
> When run in batch mode, git cat-file never frees the memory for the blob
> contents it is printing. This quickly adds up and causes git-svn to be
> hardly usable for imports of large svn repos, because it uses cat-file in
> batch mode and cat-file's memory usage easily reaches several hundred MB
> without any good reason.
>
> Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
> ---
> builtin-cat-file.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/builtin-cat-file.c b/builtin-cat-file.c
> index bd343ef..f966dcb 100644
> --- a/builtin-cat-file.c
> +++ b/builtin-cat-file.c
> @@ -183,6 +183,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
> fflush(stdout);
> }
>
> + free(contents);
> return 0;
> }
Thanks, except that it should go inside the "if (print_contents == BATCH)"
block to avoid freeing an uninitialized pointer.
next prev parent reply other threads:[~2008-06-29 3:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-28 19:48 git-svn messed up import, badly Björn Steinbrink
2008-06-28 20:57 ` [PATCH] Revert "git-svn: Speed up fetch" Avery Pennarun
2008-06-28 23:33 ` [PATCH v2] git-svn: avoid filling up the disk with temp files Avery Pennarun
2008-06-29 0:58 ` Björn Steinbrink
2008-06-29 1:21 ` [PATCH] git cat-file: Fix memory leak in batch mode Björn Steinbrink
2008-06-29 3:36 ` Junio C Hamano [this message]
2008-06-29 11:54 ` Björn Steinbrink
2008-06-29 2:24 ` [PATCH v2] git-svn: avoid filling up the disk with temp files Björn Steinbrink
2008-06-29 2:38 ` Eric Wong
2008-06-28 23:51 ` [PATCH] Revert "git-svn: Speed up fetch" Mikael Magnusson
2008-06-28 23:58 ` Avery Pennarun
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=7v1w2gkj3l.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=B.Steinbrink@gmx.de \
--cc=apenwarr@gmail.com \
--cc=aroben@apple.com \
--cc=git@vger.kernel.org \
--cc=naesten@gmail.com \
--cc=normalperson@yhbt.net \
/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).