From: Junio C Hamano <gitster@pobox.com>
To: Pierre Habouzit <madcoder@debian.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] Introduce leaky().
Date: Thu, 26 Jun 2008 11:46:43 -0700 [thread overview]
Message-ID: <7vbq1oqbjg.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1214338474-16822-2-git-send-email-madcoder@debian.org> (Pierre Habouzit's message of "Tue, 24 Jun 2008 22:14:33 +0200")
I looked at the patch (and your updated parseopt series that depends on
this that is queued at madism.org) again, but I have to say I do not like
it, not because I do not want leaks, nor because I do not want explicit
markings. The issue of helping valgrind sessions is worth addressing.
However.
First of all, it is unclear what the semantics of leaky() is. Do you want
to mark all things that will be unreacheable from anywhere in the program
at the end, or do you want to mark all things that we have obtained from
malloc(3) and friends but have not free(3)ed? Without a clear semantics
to use as the guiding principle, it would be hard for people to use this
macro properly to help debugging leaks.
Specifically, how would you envision to handle allocations of objects that
will be reachable from object.c::obj_hash at the program end? We do not
have to (and we should not) mark them using the former semantics, but we
should with the latter semantics.
The user would also need to worry about not freeing the original
allocation pointer when something is realloc(3)ed, which means either
finding the last realloc(3) of the object (that is logically the same, but
just being extended) and mark the pointer as leaky() after that realloc,
or unregister the original pointer from leaks before calling realloc and
register what comes back. It will easily get messy.
By the way, the series queued in your repository still has "s/pring/print/"
typo in 4/7 and "argv not NULL terminated" comment in 6/7.
next prev parent reply other threads:[~2008-06-26 18:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 20:14 [RFC] leaky() Pierre Habouzit
2008-06-24 20:14 ` [PATCH 1/2] Introduce leaky() Pierre Habouzit
2008-06-24 20:14 ` [PATCH 2/2] git-rev-parse: use leaky() Pierre Habouzit
2008-06-24 20:16 ` [PATCH 1/2] Introduce leaky() Pierre Habouzit
2008-06-24 21:28 ` Jakub Narebski
2008-06-24 22:10 ` Pierre Habouzit
2008-06-26 18:46 ` Junio C Hamano [this message]
2008-06-26 21:33 ` Pierre Habouzit
2008-07-22 18:09 ` Jan Hudec
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=7vbq1oqbjg.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=madcoder@debian.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).