Skip to content

Commit

Permalink
Pre-allocate htables when serializing external methodinstances
Browse files Browse the repository at this point in the history
Fixes #44338
  • Loading branch information
timholy committed Feb 25, 2022
1 parent c6b5fa2 commit cfe0c84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ static size_t queue_external_mis(jl_array_t *list)
{
size_t i, n = 0;
htable_t visited;
htable_new(&visited, 0);
if (list) {
assert(jl_is_array(list));
size_t n0 = jl_array_len(list);
htable_new(&visited, n0);
for (i = 0; i < n0; i++) {
jl_method_instance_t *mi = (jl_method_instance_t*)jl_array_ptr_ref(list, i);
assert(jl_is_method_instance(mi));
Expand Down Expand Up @@ -2640,7 +2640,7 @@ JL_DLLEXPORT int jl_save_incremental(const char *fname, jl_array_t *worklist)
arraylist_new(&reinit_list, 0);
htable_new(&edges_map, 0);
htable_new(&backref_table, 5000);
htable_new(&external_mis, 0);
htable_new(&external_mis, newly_inferred ? jl_array_len(newly_inferred) : 0);
ptrhash_put(&backref_table, jl_main_module, (char*)HT_NOTFOUND + 1);
backref_table_numel = 1;
jl_idtable_type = jl_base_module ? jl_get_global(jl_base_module, jl_symbol("IdDict")) : NULL;
Expand Down

0 comments on commit cfe0c84

Please sign in to comment.