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

[PATCH 03/26] object-store: free alt_odb_list

From
Stefan Beller <sbeller@google.com>
Date
Feb 13, 2018, 01:22 UTC
Message-ID
<20180213012241.187007-4-sbeller@google.com>
In-Reply-To
<20180213012241.187007-1-sbeller@google.com>
Free the memory and reset alt_odb_{list, tail} to NULL.
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 object.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff --git a/object.c b/object.c
index 9b5b65e189..d778f09717 100644
--- a/object.c
+++ b/object.c
@@ -446,7 +446,24 @@ void clear_commit_marks_all(unsigned int flags)
 	}
 }
 
+static void free_alt_odb(struct alternate_object_database *alt)
+{
+	strbuf_release(&alt->scratch);
+	oid_array_clear(&alt->loose_objects_cache);
+}
+
+static void free_alt_odbs(struct raw_object_store *o)
+{
+	while (o->alt_odb_list) {
+		free_alt_odb(o->alt_odb_list);
+		o->alt_odb_list = o->alt_odb_list->next;
+	}
+}
+
 void raw_object_store_clear(struct raw_object_store *o)
 {
 	free(o->objectdir);
+
+	free_alt_odbs(o);
+	o->alt_odb_tail = NULL;
 }
-- 
2.16.1.73.ga2c3e9663f.dirty
Previous: Stefan BellerNext: Stefan Beller
Message 6 of 239 in “Moving global state into the repository object (part 1)”
  1. 00/26 Moving global state into the repository object (part 1)Stefan Beller, Feb 13, 2018
  2. 01/26 repository: introduce raw object store fieldStefan Beller, Feb 13, 2018
  3. 02/26 object-store: move alt_odb_list and alt_odb_tail to object storeStefan Beller, Feb 13, 2018
  4. Brandon WilliamsFeb 13, 2018
  5. Stefan BellerFeb 13, 2018
  6. 03/26 object-store: free alt_odb_listStefan Beller, Feb 13, 2018
  7. 05/26 object-store: close all packs upon clearing the object storeStefan Beller, Feb 13, 2018
  8. 07/26 pack: move approximate object count to object storeStefan Beller, Feb 13, 2018
  9. 10/26 sha1_file: add repository argument to read_info_alternatesStefan Beller, Feb 13, 2018
  10. 08/26 sha1_file: add raw_object_store argument to alt_odb_usableStefan Beller, Feb 13, 2018
  11. 11/26 sha1_file: add repository argument to link_alt_odb_entriesStefan Beller, Feb 13, 2018
  12. 09/26 sha1_file: add repository argument to link_alt_odb_entryStefan Beller, Feb 13, 2018
  13. 15/26 sha1_file: add repository argument to sha1_file_nameStefan Beller, Feb 13, 2018
  14. 14/26 sha1_file: allow prepare_alt_odb to handle arbitrary repositoriesStefan Beller, Feb 13, 2018
  15. Duy NguyenFeb 14, 2018
  16. Brandon WilliamsFeb 14, 2018
  17. 0/2 Fix initializing the_hash_algoNguyễn Thái Ngọc Duy, Feb 23, 2018
  18. 1/2 setup.c: initialize the_repository correctly in all casesNguyễn Thái Ngọc Duy, Feb 23, 2018
  19. brian m. carlsonFeb 23, 2018
  20. Duy NguyenFeb 24, 2018
  21. 2/2 Revert "repository: pre-initialize hash algo pointer"Nguyễn Thái Ngọc Duy, Feb 23, 2018
  22. Stefan BellerFeb 23, 2018
  23. Junio C HamanoFeb 23, 2018
  24. Stefan BellerFeb 23, 2018
  25. Junio C HamanoFeb 23, 2018
  26. brian m. carlsonFeb 23, 2018
  27. Brandon WilliamsFeb 23, 2018
  28. Duy NguyenFeb 24, 2018
  29. Junio C HamanoFeb 26, 2018
  30. Duy NguyenMar 3, 2018
  31. brian m. carlsonFeb 23, 2018
  32. 0/5 Fix initializing the_hash_algoNguyễn Thái Ngọc Duy, Feb 24, 2018
  33. 1/5 setup.c: initialize the_repository correctly in all casesNguyễn Thái Ngọc Duy, Feb 24, 2018
  34. 2/5 sha1_file.c: keep a good name for "unknown" hash_algos[UNKNOWN]Nguyễn Thái Ngọc Duy, Feb 24, 2018
  35. brian m. carlsonFeb 24, 2018
  36. 3/5 index-pack: check (and optionally set) hash algo based on input fileNguyễn Thái Ngọc Duy, Feb 24, 2018
  37. brian m. carlsonFeb 24, 2018
  38. 4/5 diff.c: initialize hash algo when running in --no-index modeNguyễn Thái Ngọc Duy, Feb 24, 2018
  39. Eric SunshineFeb 24, 2018
  40. Duy NguyenFeb 24, 2018
  41. Duy NguyenFeb 24, 2018
  42. brian m. carlsonFeb 24, 2018
  43. 5/5 Revert "repository: pre-initialize hash algo pointer"Nguyễn Thái Ngọc Duy, Feb 24, 2018
  44. brian m. carlsonFeb 24, 2018
  45. Duy NguyenFeb 25, 2018
  46. brian m. carlsonFeb 25, 2018
  47. 0/6 Fix initializing the_hash_algoNguyễn Thái Ngọc Duy, Feb 25, 2018
  48. 1/6 setup.c: initialize the_repository correctly in all casesNguyễn Thái Ngọc Duy, Feb 25, 2018
  49. 2/6 sha1_file.c: keep a good name for "unknown" hash_algos[UNKNOWN]Nguyễn Thái Ngọc Duy, Feb 25, 2018
  50. 3/6 cache.h: make the_hash_algo read-onlyNguyễn Thái Ngọc Duy, Feb 25, 2018
  51. 4/6 index-pack: check (and optionally set) hash algo based on input fileNguyễn Thái Ngọc Duy, Feb 25, 2018
  52. 5/6 diff.c: initialize hash algo when running in --no-index modeNguyễn Thái Ngọc Duy, Feb 25, 2018
  53. 6/6 Revert "repository: pre-initialize hash algo pointer"Nguyễn Thái Ngọc Duy, Feb 25, 2018
  54. brian m. carlsonFeb 25, 2018
  55. Stefan BellerFeb 26, 2018
  56. 0/4 Delete ignore_env member in struct repositoryNguyễn Thái Ngọc Duy, Feb 26, 2018
  57. 1/4 repository.c: move env-related setup code back to environment.cNguyễn Thái Ngọc Duy, Feb 26, 2018
  58. Eric SunshineFeb 26, 2018
  59. Duy NguyenFeb 27, 2018
  60. Duy NguyenFeb 27, 2018
  61. Stefan BellerFeb 26, 2018
  62. Duy NguyenFeb 27, 2018
  63. 2/4 repository.c: delete dead functionsNguyễn Thái Ngọc Duy, Feb 26, 2018
  64. 3/4 sha1_file.c: move delayed getenv(altdb) back to setup_git_env()Nguyễn Thái Ngọc Duy, Feb 26, 2018
  65. 4/4 repository: delete ignore_env memberNguyễn Thái Ngọc Duy, Feb 26, 2018
  66. Junio C HamanoFeb 26, 2018
  67. Stefan BellerFeb 26, 2018
  68. Duy NguyenFeb 27, 2018
  69. 0/4 Delete ignore_env member in struct repositoryNguyễn Thái Ngọc Duy, Feb 27, 2018
  70. 1/4 repository.c: move env-related setup code back to environment.cNguyễn Thái Ngọc Duy, Feb 27, 2018
  71. Brandon WilliamsFeb 27, 2018
  72. 4/4 repository: delete ignore_env memberNguyễn Thái Ngọc Duy, Feb 27, 2018
  73. Brandon WilliamsFeb 27, 2018
  74. 2/4 repository.c: delete dead functionsNguyễn Thái Ngọc Duy, Feb 27, 2018
  75. Brandon WilliamsFeb 27, 2018
  76. 3/4 sha1_file.c: move delayed getenv(altdb) back to setup_git_env()Nguyễn Thái Ngọc Duy, Feb 27, 2018
  77. Brandon WilliamsFeb 27, 2018
  78. Duy NguyenFeb 28, 2018
  79. Eric SunshineFeb 27, 2018
  80. Stefan BellerFeb 27, 2018
  81. 0/4 Delete ignore_env member in struct repositoryNguyễn Thái Ngọc Duy, Feb 28, 2018
  82. 1/4 repository.c: move env-related setup code back to environment.cNguyễn Thái Ngọc Duy, Feb 28, 2018
  83. 2/4 repository.c: delete dead functionsNguyễn Thái Ngọc Duy, Feb 28, 2018
  84. 3/4 sha1_file.c: move delayed getenv(altdb) back to setup_git_env()Nguyễn Thái Ngọc Duy, Feb 28, 2018
  85. 4/4 repository: delete ignore_env memberNguyễn Thái Ngọc Duy, Feb 28, 2018
  86. Brandon WilliamsFeb 28, 2018
  87. Junio C HamanoFeb 28, 2018
  88. 19/26 sha1_file: add repository argument to map_sha1_fileStefan Beller, Feb 13, 2018
  89. 20/26 sha1_file: add repository argument to sha1_loose_object_infoStefan Beller, Feb 13, 2018
  90. 21/26 sha1_file: allow sha1_file_name to handle arbitrary repositoriesStefan Beller, Feb 13, 2018
  91. 22/26 sha1_file: allow stat_sha1_file to handle arbitrary repositoriesStefan Beller, Feb 13, 2018
  92. 24/26 sha1_file: allow map_sha1_file_1 to handle arbitrary repositoriesStefan Beller, Feb 13, 2018
  93. 26/26 sha1_file: allow sha1_loose_object_info to handle arbitrary repositoriesStefan Beller, Feb 13, 2018
  94. 23/26 sha1_file: allow open_sha1_file to handle arbitrary repositoriesStefan Beller, Feb 13, 2018
  95. 25/26 sha1_file: allow map_sha1_file to handle arbitrary repositoriesStefan Beller, Feb 13, 2018
  96. 16/26 sha1_file: add repository argument to stat_sha1_fileStefan Beller, Feb 13, 2018
  97. 17/26 sha1_file: add repository argument to open_sha1_fileStefan Beller, Feb 13, 2018
  98. 18/26 sha1_file: add repository argument to map_sha1_file_1Stefan Beller, Feb 13, 2018
  99. 12/26 sha1_file: add repository argument to prepare_alt_odbStefan Beller, Feb 13, 2018
  100. 13/26 sha1_file: allow link_alt_odb_entries to handle arbitrary repositoriesStefan Beller, Feb 13, 2018
  101. 06/26 pack: move prepare_packed_git_run_once to object storeStefan Beller, Feb 13, 2018
  102. 04/26 object-store: move packed_git and packed_git_mru to object storeStefan Beller, Feb 13, 2018
  103. Stefan BellerFeb 13, 2018
  104. Duy NguyenFeb 13, 2018
  105. Duy NguyenFeb 13, 2018
  106. Brandon WilliamsFeb 13, 2018
  107. Stefan BellerFeb 13, 2018
  108. Junio C HamanoFeb 13, 2018
  109. Stefan BellerFeb 13, 2018
  110. Junio C HamanoFeb 13, 2018
  111. Stefan BellerFeb 13, 2018
  112. Junio C HamanoFeb 14, 2018
  113. Jonathan NiederFeb 13, 2018
  114. Duy NguyenFeb 14, 2018
  115. Brandon WilliamsFeb 13, 2018
  116. Junio C HamanoFeb 15, 2018
  117. Stefan BellerFeb 15, 2018
  118. 00/16 Moving global state into the repository object (part 1)Stefan Beller, Feb 16, 2018
  119. 01/16 repository: introduce raw object store fieldStefan Beller, Feb 16, 2018
  120. 03/16 object-store: free alt_odb_listStefan Beller, Feb 16, 2018
  121. 02/16 object-store: move alt_odb_list and alt_odb_tail to object storeStefan Beller, Feb 16, 2018
  122. 06/16 pack: move prepare_packed_git_run_once to object storeStefan Beller, Feb 16, 2018
  123. 10/16 sha1_file: allow prepare_alt_odb to handle arbitrary object storesStefan Beller, Feb 16, 2018
  124. 12/16 sha1_file: allow stat_sha1_file to handle arbitrary object storesStefan Beller, Feb 16, 2018
  125. 14/16 sha1_file: allow map_sha1_file_1 to handle arbitrary object storesStefan Beller, Feb 16, 2018
  126. 15/16 sha1_file: allow map_sha1_file to handle arbitrary object storesStefan Beller, Feb 16, 2018
  127. 13/16 sha1_file: allow open_sha1_file to handle arbitrary object storesStefan Beller, Feb 16, 2018
  128. 16/16 sha1_file: allow sha1_loose_object_info to handle arbitrary object storesStefan Beller, Feb 16, 2018
  129. 09/16 sha1_file: allow link_alt_odb_entries to handle arbitrary object storesStefan Beller, Feb 16, 2018
  130. 11/16 sha1_file: allow sha1_file_name to handle arbitrary object storesStefan Beller, Feb 16, 2018
  131. 07/16 pack: move approximate object count to object storeStefan Beller, Feb 16, 2018
  132. 08/16 sha1_file: add raw_object_store argument to alt_odb_usableStefan Beller, Feb 16, 2018
  133. 04/16 object-store: move packed_git and packed_git_mru to object storeStefan Beller, Feb 16, 2018
  134. Junio C HamanoFeb 16, 2018
  135. 05/16 object-store: close all packs upon clearing the object storeStefan Beller, Feb 16, 2018
  136. Jonathan NiederFeb 16, 2018
  137. Stefan BellerFeb 20, 2018
  138. Brandon WilliamsFeb 20, 2018
  139. Stefan BellerFeb 20, 2018
  140. Junio C HamanoFeb 20, 2018
  141. Stefan BellerFeb 20, 2018
  142. Junio C HamanoFeb 20, 2018
  143. Stefan BellerFeb 20, 2018
  144. 00/27 Moving global state into the repository object (part 1)Stefan Beller, Feb 21, 2018
  145. 01/27 repository: introduce raw object store fieldStefan Beller, Feb 21, 2018
  146. Jonathan NiederFeb 22, 2018
  147. 02/27 object-store: migrate alternates struct and functions from cache.hStefan Beller, Feb 21, 2018
  148. Brandon WilliamsFeb 22, 2018
  149. 05/27 object-store: move packed_git and packed_git_mru to object storeStefan Beller, Feb 21, 2018
  150. Junio C HamanoFeb 21, 2018
  151. Stefan BellerFeb 23, 2018
  152. Jonathan NiederFeb 22, 2018
  153. Stefan BellerFeb 23, 2018
  154. 08/27 pack: move approximate object count to object storeStefan Beller, Feb 21, 2018
  155. Brandon WilliamsFeb 22, 2018
  156. Stefan BellerFeb 23, 2018
  157. Jeff KingFeb 26, 2018
  158. Stefan BellerFeb 26, 2018
  159. 10/27 sha1_file: add repository argument to link_alt_odb_entryStefan Beller, Feb 21, 2018
  160. 11/27 sha1_file: add repository argument to read_info_alternatesStefan Beller, Feb 21, 2018
  161. 13/27 sha1_file: add repository argument to prepare_alt_odbStefan Beller, Feb 21, 2018
  162. Jonathan NiederFeb 22, 2018
  163. Stefan BellerFeb 23, 2018
  164. 15/27 sha1_file: allow prepare_alt_odb to handle arbitrary repositoriesStefan Beller, Feb 21, 2018
  165. Jonathan TanFeb 22, 2018
  166. Stefan BellerFeb 23, 2018
  167. 14/27 sha1_file: allow link_alt_odb_entries to handle arbitrary repositoriesStefan Beller, Feb 21, 2018
  168. Brandon WilliamsFeb 22, 2018
  169. 09/27 sha1_file: add raw_object_store argument to alt_odb_usableStefan Beller, Feb 21, 2018
  170. Jonathan TanFeb 22, 2018
  171. 19/27 sha1_file: add repository argument to map_sha1_file_1Stefan Beller, Feb 21, 2018
  172. Jonathan TanFeb 22, 2018
  173. 18/27 sha1_file: add repository argument to open_sha1_fileStefan Beller, Feb 21, 2018
  174. 24/27 sha1_file: allow open_sha1_file to handle arbitrary repositoriesStefan Beller, Feb 21, 2018
  175. Jonathan TanFeb 22, 2018
  176. 22/27 sha1_file: allow sha1_file_name to handle arbitrary repositoriesStefan Beller, Feb 21, 2018
  177. Jonathan TanFeb 22, 2018
  178. Stefan BellerFeb 23, 2018
  179. 23/27 sha1_file: allow stat_sha1_file to handle arbitrary repositoriesStefan Beller, Feb 21, 2018
  180. 27/27 sha1_file: allow sha1_loose_object_info to handle arbitrary repositoriesStefan Beller, Feb 21, 2018
  181. 26/27 sha1_file: allow map_sha1_file to handle arbitrary repositoriesStefan Beller, Feb 21, 2018
  182. Jonathan NiederFeb 22, 2018
  183. 25/27 sha1_file: allow map_sha1_file_1 to handle arbitrary repositoriesStefan Beller, Feb 21, 2018
  184. 20/27 sha1_file: add repository argument to map_sha1_fileStefan Beller, Feb 21, 2018
  185. 21/27 sha1_file: add repository argument to sha1_loose_object_infoStefan Beller, Feb 21, 2018
  186. Jonathan NiederFeb 22, 2018
  187. 12/27 sha1_file: add repository argument to link_alt_odb_entriesStefan Beller, Feb 21, 2018
  188. 17/27 sha1_file: add repository argument to stat_sha1_fileStefan Beller, Feb 21, 2018
  189. Jonathan NiederFeb 22, 2018
  190. 03/27 object-store: move alt_odb_list and alt_odb_tail to object storeStefan Beller, Feb 21, 2018
  191. Brandon WilliamsFeb 22, 2018
  192. 16/27 sha1_file: add repository argument to sha1_file_nameStefan Beller, Feb 21, 2018
  193. Brandon WilliamsFeb 22, 2018
  194. Stefan BellerFeb 23, 2018
  195. Brandon WilliamsFeb 23, 2018
  196. 04/27 object-store: free alt_odb_listStefan Beller, Feb 21, 2018
  197. Brandon WilliamsFeb 22, 2018
  198. 07/27 pack: move prepare_packed_git_run_once to object storeStefan Beller, Feb 21, 2018
  199. Jonathan TanFeb 22, 2018
  200. 06/27 object-store: close all packs upon clearing the object storeStefan Beller, Feb 21, 2018
  201. Brandon WilliamsFeb 22, 2018
  202. Stefan BellerFeb 22, 2018
  203. 00/27 Moving global state into the repository object (part 1)Stefan Beller, Feb 24, 2018
  204. 01/27 repository: introduce raw object store fieldStefan Beller, Feb 24, 2018
  205. Duy NguyenFeb 26, 2018
  206. Junio C HamanoFeb 26, 2018
  207. Brandon WilliamsFeb 26, 2018
  208. Stefan BellerFeb 26, 2018
  209. Duy NguyenFeb 26, 2018
  210. 02/27 object-store: migrate alternates struct and functions from cache.hStefan Beller, Feb 24, 2018
  211. 04/27 object-store: free alt_odb_listStefan Beller, Feb 24, 2018
  212. 05/27 object-store: move packed_git and packed_git_mru to object storeStefan Beller, Feb 24, 2018
  213. 08/27 pack: move approximate object count to object storeStefan Beller, Feb 24, 2018
  214. 06/27 object-store: close all packs upon clearing the object storeStefan Beller, Feb 24, 2018
  215. 03/27 object-store: move alt_odb_list and alt_odb_tail to object storeStefan Beller, Feb 24, 2018
  216. 15/27 sha1_file: allow prepare_alt_odb to handle arbitrary repositoriesStefan Beller, Feb 24, 2018
  217. 19/27 sha1_file: add repository argument to map_sha1_file_1Stefan Beller, Feb 24, 2018
  218. 16/27 sha1_file: add repository argument to sha1_file_nameStefan Beller, Feb 24, 2018
  219. 22/27 sha1_file: allow sha1_file_name to handle arbitrary repositoriesStefan Beller, Feb 24, 2018
  220. 23/27 sha1_file: allow stat_sha1_file to handle arbitrary repositoriesStefan Beller, Feb 24, 2018
  221. 20/27 sha1_file: add repository argument to map_sha1_fileStefan Beller, Feb 24, 2018
  222. 26/27 sha1_file: allow map_sha1_file to handle arbitrary repositoriesStefan Beller, Feb 24, 2018
  223. 27/27 sha1_file: allow sha1_loose_object_info to handle arbitrary repositoriesStefan Beller, Feb 24, 2018
  224. 21/27 sha1_file: add repository argument to sha1_loose_object_infoStefan Beller, Feb 24, 2018
  225. 25/27 sha1_file: allow map_sha1_file_1 to handle arbitrary repositoriesStefan Beller, Feb 24, 2018
  226. 10/27 sha1_file: add repository argument to link_alt_odb_entryStefan Beller, Feb 24, 2018
  227. 24/27 sha1_file: allow open_sha1_file to handle arbitrary repositoriesStefan Beller, Feb 24, 2018
  228. 17/27 sha1_file: add repository argument to stat_sha1_fileStefan Beller, Feb 24, 2018
  229. 18/27 sha1_file: add repository argument to open_sha1_fileStefan Beller, Feb 24, 2018
  230. 13/27 sha1_file: add repository argument to prepare_alt_odbStefan Beller, Feb 24, 2018
  231. 14/27 sha1_file: allow link_alt_odb_entries to handle arbitrary repositoriesStefan Beller, Feb 24, 2018
  232. 07/27 pack: move prepare_packed_git_run_once to object storeStefan Beller, Feb 24, 2018
  233. 12/27 sha1_file: add repository argument to link_alt_odb_entriesStefan Beller, Feb 24, 2018
  234. 09/27 sha1_file: add raw_object_store argument to alt_odb_usableStefan Beller, Feb 24, 2018
  235. 11/27 sha1_file: add repository argument to read_info_alternatesStefan Beller, Feb 24, 2018
  236. Duy NguyenFeb 24, 2018
  237. Stefan BellerFeb 26, 2018
  238. Duy NguyenFeb 27, 2018
  239. Jonathan TanFeb 26, 2018

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.