changed memory growth

This commit is contained in:
Chris Cromer 2016-10-17 11:45:23 -03:00
parent 9c97e62e04
commit f57e74850b

View File

@ -65,7 +65,10 @@ int readfile(CONFIG *config) {
/* not enough memory for more lines, time to allocate more memory */ /* not enough memory for more lines, time to allocate more memory */
if (lines == new_max) { if (lines == new_max) {
new_max = new_max * 2; /* uses more memory but runs faster */
/*new_max = new_max * 2;*/
/* uses less memory but runs slower */
new_max = new_max + MAX_LINES;
char **tmp = realloc(array, new_max * sizeof(*array)); char **tmp = realloc(array, new_max * sizeof(*array));
if (!tmp) { if (!tmp) {
fprintf(stderr, "Reallocación de memoria falló."); fprintf(stderr, "Reallocación de memoria falló.");