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

[PATCH] Reduce memory usage in git-update-server-info.

From
Rrobfitz@273k.net <robfitz@273k.net>
Date
Oct 6, 2005, 22:49 UTC
Message-ID
<11286389433926-git-send-email-robfitz@273k.net>

Modify parse_object_cheap() to also free all the entries from the tree data structures.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---
 server-info.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

applies-to: fc843c89d12160dfe9704e7a0dd678cc729459cb 67be887f195205e36c7eec39b9caea249a435e95

diff --git a/server-info.c b/server-info.c
--- a/server-info.c
+++ b/server-info.c
@@ -59,6 +59,16 @@ static struct object *parse_object_cheap
 		struct commit *commit = (struct commit *)o;
 		free(commit->buffer);
 		commit->buffer = NULL;
+	} else if (o->type == tree_type) {
+		struct tree *tree = (struct tree *)o;
+		struct tree_entry_list *e, *n;
+		for (e = tree->entries; e; e = n) {
+			free(e->name);
+			e->name = NULL;
+			n = e->next;
+			free(e);
+		}
+		tree->entries = NULL;
 	}
 	return o;
 }
---
0.99.8.GIT
Message 1 of 1 in “Reduce memory usage in git-update-server-info.”
  1. Reduce memory usage in git-update-server-info.robfitz@273k.net, Oct 6, 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.