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

Re: Summary of core GIT while you are away.

From
Linus Torvalds <torvalds@osdl.org>
Date
May 26, 2005, 01:53 UTC
Message-ID
<Pine.LNX.4.58.0505251845270.2307@ppc970.osdl.org>
In-Reply-To
<7vzmuig561.fsf@assigned-by-dhcp.cox.net>
On Wed, 25 May 2005, Junio C Hamano wrote:
> 
> I haven't done anything about this yet.  I was kind of waiting
> for the blob retention API for "struct object" derivatives to
> come to the conclusion.
I decided on it, and it's a hacky (but reasonable) decision.

"parse_commit()" always retains the buffer for the commit. It's very commit-specific, since (a) that's the main data structure that you'd actually want to retain and (b) of all the core objects (ignoring tags) commits tend to be the smallest and fewest, so this fixed policy has the least impact memory-usage-wise.

If you want to free it, you can do
	free(commit->buffer);
	commit->buffer = NULL;

and you should be all good (but the only user I thought migh want to is "fsck", and that one doesn't need to, since it never calls "parse_commit()" at all - it calls "parse_commit_buffer()" which does _not_ do this, since the caller already knows the buffer and can choose to do it if it wants to.

Oh, thinking about that actually brings up a bug: mixing parse_commit() and parse_commit_buffer() is unsafe, since the state of the buffer is unclear. Normally that's ok, _except_ when we use just "parse_object()" (like we do in "lookup_commit_reference()"), when we really don't know. Hmm.

		Linus
Previous: Junio C HamanoNext: Linus Torvalds
Message 10 of 28 in “Summary of core GIT while you are away.”
  1. Junio C HamanoMay 14, 2005
  2. Linus TorvaldsMay 16, 2005
  3. rev-list/tree committer/author information.Junio C Hamano, May 16, 2005
  4. Petr BaudisMay 16, 2005
  5. Daniel BarkalowMay 16, 2005
  6. Junio C HamanoMay 16, 2005
  7. Petr BaudisMay 16, 2005
  8. Kay SieversMay 26, 2005
  9. Junio C HamanoMay 26, 2005
  10. Linus TorvaldsMay 26, 2005
  11. Linus TorvaldsMay 26, 2005
  12. Kay SieversMay 26, 2005
  13. Junio C HamanoMay 26, 2005
  14. Kay SieversMay 26, 2005
  15. Junio C HamanoMay 26, 2005
  16. H. Peter AnvinMay 27, 2005
  17. Junio C HamanoMay 27, 2005
  18. H. Peter AnvinMay 27, 2005
  19. Junio C HamanoMay 27, 2005
  20. H. Peter AnvinMay 27, 2005
  21. Junio C HamanoMay 27, 2005
  22. Linus TorvaldsMay 27, 2005
  23. H. Peter AnvinMay 26, 2005
  24. Junio C HamanoMay 26, 2005
  25. Kay SieversMay 26, 2005
  26. Junio C HamanoMay 27, 2005
  27. Kay SieversMay 27, 2005
  28. Junio C HamanoMay 27, 2005

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.