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

[PATCH 2/3] pack-redundant: free all memory

From
Stefan Beller <sbeller@google.com>
Date
May 17, 2016, 03:22 UTC
Message-ID
<20160517032247.25092-3-sbeller@google.com>
In-Reply-To
<20160517032247.25092-1-sbeller@google.com>
From: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/pack-redundant.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c
index 72c8158..c75c5c9 100644
--- a/builtin/pack-redundant.c
+++ b/builtin/pack-redundant.c
@@ -223,6 +223,18 @@ static inline size_t pack_list_size(struct pack_list *pl)
 	return ret;
 }
 
+static inline void pack_list_free(struct pack_list *pl)
+{
+	struct pack_list *cur_pl;
+	while (pl) {
+		llist_free(pl->unique_objects);
+		llist_free(pl->all_objects);
+		cur_pl = pl;
+		pl = pl->next;
+		free(cur_pl);
+	}
+}
+
 static struct pack_list * pack_list_difference(const struct pack_list *A,
 					       const struct pack_list *B)
 {
@@ -691,5 +703,10 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix)
 		fprintf(stderr, "%luMB of redundant packs in total.\n",
 			(unsigned long)pack_set_bytecount(red)/(1024*1024));
 
+#ifdef FREE_ALL_MEMORY
+	pack_list_free(red);
+	llist_free(ignore);
+#endif
+
 	return 0;
 }
-- 
2.8.2.401.g9c0faef
Previous: Torsten BögershausenNext: Eric Sunshine
Message 4 of 15 in “Free all the memory!”
  1. 0/3 Free all the memory!Stefan Beller, May 17, 2016
  2. 1/3 mv: free memory at the end if desiredStefan Beller, May 17, 2016
  3. Torsten BögershausenMay 17, 2016
  4. 2/3 pack-redundant: free all memoryStefan Beller, May 17, 2016
  5. Eric SunshineMay 17, 2016
  6. 3/3 rev-parse: free all memoryStefan Beller, May 17, 2016
  7. Eric SunshineMay 17, 2016
  8. Eric WongMay 17, 2016
  9. Stefan BellerMay 17, 2016
  10. Junio C HamanoMay 17, 2016
  11. Stefan BellerMay 17, 2016
  12. Eric WongMay 18, 2016
  13. Ævar Arnfjörð BjarmasonMay 18, 2016
  14. David TurnerMay 17, 2016
  15. Matthieu MoyMay 17, 2016

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.