Merge branch 'jk/drop-release-pack-memory'
authorJunio C Hamano <gitster@pobox.com>
Wed, 18 Sep 2019 18:50:07 +0000 (11:50 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 18 Sep 2019 18:50:08 +0000 (11:50 -0700)
xmalloc() used to have a mechanism to ditch memory and address
space resources as the last resort upon seeing an allocation
failure from the underlying malloc(), which made the code complex
and thread-unsafe with dubious benefit, as major memory resource
users already do limit their uses with various other mechanisms.
It has been simplified away.

* jk/drop-release-pack-memory:
packfile: drop release_pack_memory()

1  2 
builtin/pack-objects.c
diff --combined builtin/pack-objects.c
index b410801edb6b8a18ffff17b6c720db98d4238106,93e92876aa76378883471414c2a044edfa77eca4..c8f51bc65c3621d945ad4a11d9c08929a5250862
@@@ -2342,15 -2342,6 +2342,6 @@@ static void find_deltas(struct object_e
        free(array);
  }
  
- static void try_to_free_from_threads(size_t size)
- {
-       packing_data_lock(&to_pack);
-       release_pack_memory(size);
-       packing_data_unlock(&to_pack);
- }
- static try_to_free_t old_try_to_free_routine;
  /*
   * The main object list is split into smaller lists, each is handed to
   * one worker.
@@@ -2391,12 -2382,10 +2382,10 @@@ static void init_threaded_search(void
        pthread_mutex_init(&cache_mutex, NULL);
        pthread_mutex_init(&progress_mutex, NULL);
        pthread_cond_init(&progress_cond, NULL);
-       old_try_to_free_routine = set_try_to_free_routine(try_to_free_from_threads);
  }
  
  static void cleanup_threaded_search(void)
  {
-       set_try_to_free_routine(old_try_to_free_routine);
        pthread_cond_destroy(&progress_cond);
        pthread_mutex_destroy(&cache_mutex);
        pthread_mutex_destroy(&progress_mutex);
@@@ -2715,6 -2704,10 +2704,6 @@@ static int git_pack_config(const char *
                use_bitmap_index_default = git_config_bool(k, v);
                return 0;
        }
 -      if (!strcmp(k, "pack.usesparse")) {
 -              sparse = git_config_bool(k, v);
 -              return 0;
 -      }
        if (!strcmp(k, "pack.threads")) {
                delta_search_threads = git_config_int(k, v);
                if (delta_search_threads < 0)
@@@ -3339,10 -3332,6 +3328,10 @@@ int cmd_pack_objects(int argc, const ch
        read_replace_refs = 0;
  
        sparse = git_env_bool("GIT_TEST_PACK_SPARSE", 0);
 +      prepare_repo_settings(the_repository);
 +      if (!sparse && the_repository->settings.pack_use_sparse != -1)
 +              sparse = the_repository->settings.pack_use_sparse;
 +
        reset_pack_idx_option(&pack_idx_opts);
        git_config(git_pack_config, NULL);