git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sverre Rabbelier <srabbelier@gmail.com>
To: Daniel Barkalow <barkalow@iabervon.org>
Cc: git@vger.kernel.org
Subject: Re: excerpts from tomorrow's "What's cooking" draft
Date: Sun, 15 Nov 2009 03:07:50 +0100	[thread overview]
Message-ID: <fabb9a1e0911141807q4be6015bjda4805496be6dbb3@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.0911111259520.14365@iabervon.org>

Heya,

On Wed, Nov 11, 2009 at 19:45, Daniel Barkalow <barkalow@iabervon.org> wrote:
> Okay, finally got to it just now. This is entirely untested (because I
> don't have anything that uses it), but it compiles and should be correct.
> It would be nice to get a clean bill of health on it from valgrind.

After a lot of manual comparison of valgrind traces (comparing cloning
a local git repo and a local hg repo), I have found the following
before applying your patch (I removed the ==proc== and "by 0xDEADBEEF"
noise):

  20 bytes in 1 blocks are definitely lost in loss record 24 of 95
    at : calloc (vg_replace_malloc.c:418)
    by : xcalloc (wrapper.c:75)
    by : get_importer (transport-helper.c:132)
    by : fetch_with_import (transport-helper.c:150)
    by : fetch (transport-helper.c:198)
    by : transport_fetch_refs (transport.c:977)
    by : cmd_clone (builtin-clone.c:538)
    by : run_builtin (git.c:251)
    by : handle_internal_command (git.c:396)
    by : run_argv (git.c:438)
    by : main (git.c:509)

  60 bytes in 1 blocks are definitely lost in loss record 43 of 95
    at : realloc (vg_replace_malloc.c:476)
    by : xrealloc (wrapper.c:59)
    by : strbuf_grow (strbuf.c:61)
    by : strbuf_getwholeline (strbuf.c:335)
    by : strbuf_getline (strbuf.c:349)
    by : get_helper (transport-helper.c:52)
    by : get_refs_list (transport-helper.c:228)
    by : transport_get_remote_refs (transport.c:943)
    by : cmd_clone (builtin-clone.c:535)
    by : run_builtin (git.c:251)
    by : handle_internal_command (git.c:396)
    by : run_argv (git.c:438)

  65 bytes in 1 blocks are definitely lost in loss record 47 of 95
    at : malloc (vg_replace_malloc.c:195)
    by : realloc (vg_replace_malloc.c:476)
    by : xrealloc (wrapper.c:59)
    by : strbuf_grow (strbuf.c:61)
    by : strbuf_addf (strbuf.c:199)
    by : get_helper (transport-helper.c:69)
    by : get_refs_list (transport-helper.c:228)
    by : transport_get_remote_refs (transport.c:943)
    by : cmd_clone (builtin-clone.c:535)
    by : run_builtin (git.c:251)
    by : handle_internal_command (git.c:396)
    by : run_argv (git.c:438)

  65 bytes in 1 blocks are definitely lost in loss record 50 of 95
    at : malloc (vg_replace_malloc.c:195)
    by : realloc (vg_replace_malloc.c:476)
    by : xrealloc (wrapper.c:59)
    by : strbuf_grow (strbuf.c:61)
    by : strbuf_addf (strbuf.c:199)
    by : fetch_with_import (transport-helper.c:158)
    by : fetch (transport-helper.c:198)
    by : transport_fetch_refs (transport.c:977)
    by : cmd_clone (builtin-clone.c:538)
    by : run_builtin (git.c:251)
    by : handle_internal_command (git.c:396)
    by : run_argv (git.c:438)

  123 (96 direct, 27 indirect) bytes in 1 blocks are definitely lost
in loss record 71 of 95
    at : malloc (vg_replace_malloc.c:195)
    by : realloc (vg_replace_malloc.c:476)
    by : xrealloc (wrapper.c:59)
    by : get_helper (transport-helper.c:62)
    by : get_refs_list (transport-helper.c:228)
    by : transport_get_remote_refs (transport.c:943)
    by : cmd_clone (builtin-clone.c:535)
    by : run_builtin (git.c:251)
    by : handle_internal_command (git.c:396)
    by : run_argv (git.c:438)
    by : main (git.c:509)

Annotated with the relevant source and my comments:
    by : get_importer (transport-helper.c:132)
	fastimport->argv = xcalloc(5, sizeof(*fastimport->argv));

You never free fastimport->argv.

    by : get_helper (transport-helper.c:52)
		if (strbuf_getline(&buf, file, '\n') == EOF)

You never strbuf_release(&buf).

    by : get_helper (transport-helper.c:69)
			strbuf_addf(&gitdir, "gitdir %s\n", get_git_dir());

I do strbuf_reset(&gitdir), which should of course be
strbuf_release(&gitdir), oops.

    by : fetch_with_import (transport-helper.c:158)
		strbuf_addf(&buf, "import %s\n", posn->name);

Same here, you never strbuf_release(&buf).

    by : get_helper (transport-helper.c:62)
			ALLOC_GROW(refspecs,
				   refspec_nr + 1,
				   refspec_alloc);

This would of course be fixed by your patch.

However, applying your patch causes:
error: Trying to write ref refs/heads/tip with nonexistant object
0000000000000000000000000000000000000000
fatal: Cannot update the ref 'HEAD'.

If I comment out both new lines in disonnect_helper like so fixes that:
	//free_refspec(data->refspec_nr, data->refspecs);
	//data->refspecs = NULL;

Commenting out only one of the two makes the error return, any idea's?

-- 
Cheers,

Sverre Rabbelier

  reply	other threads:[~2009-11-15  2:08 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11  9:34 excerpts from tomorrow's "What's cooking" draft Junio C Hamano
2009-11-11 16:33 ` Ben Walton
2009-11-11 17:07 ` Johan Herland
2009-11-11 17:57 ` Sverre Rabbelier
2009-11-11 18:45   ` Daniel Barkalow
2009-11-15  2:07     ` Sverre Rabbelier [this message]
2009-11-15  2:49       ` Daniel Barkalow
2009-11-11 22:08   ` ks/precompute-completion Jonathan Nieder
2009-11-13  6:40     ` ks/precompute-completion Stephen Boyd
2009-11-13  7:06       ` ks/precompute-completion Jonathan Nieder
2009-11-13  7:12         ` ks/precompute-completion Stephen Boyd
2009-11-13  8:50           ` [PATCH] Speed up bash completion loading Jonathan Nieder
2009-11-13  9:03             ` Jonathan Nieder
2009-11-13 10:29               ` Jonathan Nieder
2009-11-13 20:43               ` Stephen Boyd
2009-11-14 10:35                 ` Jonathan Nieder
2009-11-14 11:01                 ` Jonathan Nieder
2009-11-14 14:43                   ` SZEDER Gábor
2009-11-14 19:33                     ` Jonathan Nieder
2009-11-14 23:46                   ` Stephen Boyd
2009-11-15  6:50                     ` Jonathan Nieder
2009-11-15  9:05                   ` Junio C Hamano
2009-11-15 10:29                     ` [PATCH v2] " Jonathan Nieder
2009-11-16  1:55                       ` Shawn O. Pearce
2009-11-16  8:28                       ` Stephen Boyd
2009-11-18  0:49                         ` [PATCH v3] " Jonathan Nieder
2009-11-18  0:59                           ` Shawn O. Pearce
2009-11-11 18:42 ` excerpts from tomorrow's "What's cooking" draft Nicolas Sebrecht
2009-11-11 19:50   ` Nicolas Pitre
2009-11-11 21:07     ` Petr Baudis
2009-11-11 21:19       ` Nicolas Pitre
2009-11-11 21:26         ` Nicolas Sebrecht
2009-11-11 21:42         ` Petr Baudis
2009-11-11 22:04           ` Nicolas Pitre
2009-11-11 22:24           ` [PATCH] give priority to progress messages Nicolas Pitre
2009-11-11 18:54 ` excerpts from tomorrow's "What's cooking" draft Jakub Narebski

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=fabb9a1e0911141807q4be6015bjda4805496be6dbb3@mail.gmail.com \
    --to=srabbelier@gmail.com \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    /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).