less memory usage

This commit is contained in:
Chris Cromer 2016-10-17 22:10:03 -03:00
parent 8361f1071a
commit c14e0f88a8

View File

@ -64,7 +64,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; /* faster, but uses more ram while running */
/*new_max = new_max * 2;*/
/* slower, but uses less ram */
new_max = new_max + 100;
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ó.");