From: Junio C Hamano Date: Thu, 2 Aug 2018 22:30:43 +0000 (-0700) Subject: Merge branch 'jm/cache-entry-from-mem-pool' X-Git-Tag: v2.19.0-rc0~101 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ae533c4a92aef6ab180441dbb76ef83521fc87d6 Merge branch 'jm/cache-entry-from-mem-pool' For a large tree, the index needs to hold many cache entries allocated on heap. These cache entries are now allocated out of a dedicated memory pool to amortize malloc(3) overhead. * jm/cache-entry-from-mem-pool: block alloc: add validations around cache_entry lifecyle block alloc: allocate cache entries from mem_pool mem-pool: fill out functionality mem-pool: add life cycle management functions mem-pool: only search head block for available space block alloc: add lifecycle APIs for cache_entry structs read-cache: teach make_cache_entry to take object_id read-cache: teach refresh_cache_entry to take istate --- ae533c4a92aef6ab180441dbb76ef83521fc87d6 diff --cc apply.c index 49752cde44,ee6c406c7a..2594927248 --- a/apply.c +++ b/apply.c @@@ -4266,9 -4263,11 +4266,8 @@@ static int add_index_file(struct apply_ struct stat st; struct cache_entry *ce; int namelen = strlen(path); - unsigned ce_size = cache_entry_size(namelen); - ce = xcalloc(1, ce_size); - if (!state->update_index) - return 0; - + ce = make_empty_cache_entry(&the_index, namelen); memcpy(ce->name, path, namelen); ce->ce_mode = create_ce_mode(mode); ce->ce_flags = create_ce_flags(0);