summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJameson Miller <jamill@microsoft.com>2018-07-02 19:49:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-03 17:58:27 (GMT)
commit8616a2d0cb57865540f1c00ac2e5385a6cc5d84e (patch)
treeaa15c9800bf6305fd1dd5491b3abb2a591b1d089 /cache.h
parent8e72d67529ba0adfb6f7d24a21e909c2a1e1d069 (diff)
downloadgit-8616a2d0cb57865540f1c00ac2e5385a6cc5d84e.zip
git-8616a2d0cb57865540f1c00ac2e5385a6cc5d84e.tar.gz
git-8616a2d0cb57865540f1c00ac2e5385a6cc5d84e.tar.bz2
block alloc: add validations around cache_entry lifecyle
Add an option (controlled by an environment variable) perform extra validations on mem_pool allocated cache entries. When set: 1) Invalidate cache_entry memory when discarding cache_entry. 2) When discarding index_state struct, verify that all cache_entries were allocated from expected mem_pool. 3) When discarding mem_pools, invalidate mem_pool memory. This should provide extra checks that mem_pools and their allocated cache_entries are being used as expected. Signed-off-by: Jameson Miller <jamill@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index c1c7e9e..a3334a7 100644
--- a/cache.h
+++ b/cache.h
@@ -381,6 +381,12 @@ struct cache_entry *make_empty_transient_cache_entry(size_t name_len);
void discard_cache_entry(struct cache_entry *ce);
/*
+ * Check configuration if we should perform extra validation on cache
+ * entries.
+ */
+int should_validate_cache_entries(void);
+
+/*
* Duplicate a cache_entry. Allocate memory for the new entry from a
* memory_pool. Takes into account cache_entry fields that are meant
* for managing the underlying memory allocation of the cache_entry.