Skip to content

Commit 5f0e409

Browse files
brammooldouglasdrumond
authored andcommitted
updated for version 7.4.615
Problem: Vim hangs when freeing a lot of objects. Solution: Do not go back to the start of the list every time. (Yasuhiro Matsumoto and Ariya Mizutani)
1 parent e2adb7b commit 5f0e409

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/eval.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5974,7 +5974,7 @@ list_unref(l)
59745974
}
59755975

59765976
/*
5977-
* Free a list, including all items it points to.
5977+
* Free a list, including all non-container items it points to.
59785978
* Ignores the reference count.
59795979
*/
59805980
void
@@ -6941,34 +6941,35 @@ garbage_collect()
69416941
free_unref_items(copyID)
69426942
int copyID;
69436943
{
6944-
dict_T *dd;
6945-
list_T *ll;
6944+
dict_T *dd, *dd_next;
6945+
list_T *ll, *ll_next;
69466946
int did_free = FALSE;
69476947

69486948
/*
69496949
* Go through the list of dicts and free items without the copyID.
69506950
*/
69516951
for (dd = first_dict; dd != NULL; )
6952+
{
6953+
dd_next = dd->dv_used_next;
69526954
if ((dd->dv_copyID & COPYID_MASK) != (copyID & COPYID_MASK))
69536955
{
69546956
/* Free the Dictionary and ordinary items it contains, but don't
69556957
* recurse into Lists and Dictionaries, they will be in the list
69566958
* of dicts or list of lists. */
69576959
dict_free(dd, FALSE);
69586960
did_free = TRUE;
6959-
6960-
/* restart, next dict may also have been freed */
6961-
dd = first_dict;
69626961
}
6963-
else
6964-
dd = dd->dv_used_next;
6962+
dd = dd_next;
6963+
}
69656964

69666965
/*
69676966
* Go through the list of lists and free items without the copyID.
69686967
* But don't free a list that has a watcher (used in a for loop), these
69696968
* are not referenced anywhere.
69706969
*/
69716970
for (ll = first_list; ll != NULL; )
6971+
{
6972+
ll_next = ll->lv_used_next;
69726973
if ((ll->lv_copyID & COPYID_MASK) != (copyID & COPYID_MASK)
69736974
&& ll->lv_watch == NULL)
69746975
{
@@ -6977,13 +6978,9 @@ free_unref_items(copyID)
69776978
* or list of lists. */
69786979
list_free(ll, FALSE);
69796980
did_free = TRUE;
6980-
6981-
/* restart, next list may also have been freed */
6982-
ll = first_list;
69836981
}
6984-
else
6985-
ll = ll->lv_used_next;
6986-
6982+
ll = ll_next;
6983+
}
69876984
return did_free;
69886985
}
69896986

@@ -7213,7 +7210,7 @@ dict_unref(d)
72137210
}
72147211

72157212
/*
7216-
* Free a Dictionary, including all items it contains.
7213+
* Free a Dictionary, including all non-container items it contains.
72177214
* Ignores the reference count.
72187215
*/
72197216
void

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
615,
744746
/**/
745747
614,
746748
/**/

0 commit comments

Comments
 (0)