Browse Source

changed memory growth

master
Chris Cromer 3 years ago
parent
commit
f57e74850b
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      src/readfile.c

+ 4
- 1
src/readfile.c View File

@@ -65,7 +65,10 @@ int readfile(CONFIG *config) {

/* not enough memory for more lines, time to allocate more memory */
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));
if (!tmp) {
fprintf(stderr, "Reallocación de memoria falló.");


Loading…
Cancel
Save