[exim-cvs] preallocate store for config

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] preallocate store for config
Gitweb: https://git.exim.org/exim.git/commitdiff/00f1386065b4ab2aed12facd883ebd324c8c66d5
Commit:     00f1386065b4ab2aed12facd883ebd324c8c66d5
Parent:     c9f1be94cc304f0343c93b66efa41a747d307fb1
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sat Jul 6 22:17:04 2019 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Fri Aug 2 17:56:17 2019 +0100


    preallocate store for config
---
 src/src/readconf.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)


diff --git a/src/src/readconf.c b/src/src/readconf.c
index d13d051..f55c1da 100644
--- a/src/src/readconf.c
+++ b/src/src/readconf.c
@@ -3341,6 +3341,19 @@ if (f.trusted_config && Ustrcmp(filename, US"/dev/null"))
     }
   }


+/* Do a dummy store-allocation of a size related to the (toplevel) file size.
+This assumes we will need this much storage to handle all the allocations
+during startup; it won't help when .include is being used. When it does, it
+will cut down on the number of store blocks (and malloc calls, and sbrk
+syscalls). It also assume we're on the relevant pool. */
+
+if (statbuf.st_size > 8192)
+ {
+ rmark r = store_mark();
+ store_get((int)statbuf.st_size, FALSE);
+ store_reset(r);
+ }
+
/* Process the main configuration settings. They all begin with a lower case
letter. If we see something starting with an upper case letter, it is taken as
a macro definition. */