git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] Introduce leaky().

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 26, 2008, 18:46 UTC
Message-ID
<7vbq1oqbjg.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1214338474-16822-2-git-send-email-madcoder@debian.org>

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.

Previous: Pierre HabouzitNext: Pierre Habouzit
Message 7 of 9 in “[RFC] leaky()”
  1. Pierre HabouzitJun 24, 2008
  2. 1/2 Introduce leaky().Pierre Habouzit, Jun 24, 2008
  3. 2/2 git-rev-parse: use leaky().Pierre Habouzit, Jun 24, 2008
  4. Pierre HabouzitJun 24, 2008
  5. Jakub NarebskiJun 24, 2008
  6. Pierre HabouzitJun 24, 2008
  7. Junio C HamanoJun 26, 2008
  8. Pierre HabouzitJun 26, 2008
  9. Jan HudecJul 22, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.