listitem_T *li;
int todo;
dictitem_T *v;
+ static int made_copy = 0;
/* "fc" is still in use. This can happen when returning "a:000",
* assigning "l:" to a global variable or defining a closure.
/* Make a copy of the a:000 items, since we didn't do that above. */
for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
copy_tv(&li->li_tv, &li->li_tv);
+
+ if (++made_copy == 10000)
+ {
+ // We have made a lot of copies. This can happen when
+ // repetitively calling a function that creates a reference to
+ // itself somehow. Call the garbage collector here to avoid using
+ // too much memory.
+ made_copy = 0;
+ (void)garbage_collect(FALSE);
+ }
}
}
line_breakcheck(); /* check for CTRL-C hit */
fc = (funccall_T *)alloc(sizeof(funccall_T));
+ if (fc == NULL)
+ return;
fc->caller = current_funccal;
current_funccal = fc;
fc->func = fp;