ga_init2(&qfga, 1, 256);
}
- // Retain ga_data from previous use. Reset the length to zero.
+ // Reset the length to zero. Retain ga_data from previous use to avoid
+ // many alloc/free calls.
qfga.ga_len = 0;
return &qfga;
}
+/*
+ * The "qfga" grow array buffer is reused across multiple quickfix commands as
+ * a temporary buffer to reduce the number of alloc/free calls. But if the
+ * buffer size is large, then to avoid holding on to that memory, clear the
+ * grow array. Otherwise just reset the grow array length.
+ */
+ static void
+qfga_clear(void)
+{
+ if (qfga.ga_maxlen > 1000)
+ ga_clear(&qfga);
+ else
+ qfga.ga_len = 0;
+}
+
/*
* Maximum number of bytes allowed per line while reading a errorfile.
*/
msg_scroll = FALSE;
msg_attr_keep((char *)gap->ga_data, 0, TRUE);
msg_scroll = i;
+
+ qfga_clear();
}
/*
ui_breakcheck();
}
+ qfga_clear();
}
/*
if (old_last == NULL)
// Delete the empty line which is now at the end
(void)ml_delete(lnum + 1);
+
+ qfga_clear();
}
// correct cursor position