summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-11-01 08:56:26 +0100
committerMaria Matejka <mq@ucw.cz>2022-11-01 16:38:24 +0100
commit37b644413723670928f6b54f2abe0c852eb0b652 (patch)
treed8e8023f23803d0117cf02f7ea1922d5d8e5f531 /conf
parent5aebce5e0cc59c4c8459ab92a201df5868f46e7a (diff)
Moved config-related allocations to config_pool and showing its size in memory usage
Diffstat (limited to 'conf')
-rw-r--r--conf/cf-lex.l2
-rw-r--r--conf/conf.c9
-rw-r--r--conf/conf.h2
-rw-r--r--conf/flowspec.Y2
4 files changed, 9 insertions, 6 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l
index 28d9ba50..ceedee8a 100644
--- a/conf/cf-lex.l
+++ b/conf/cf-lex.l
@@ -717,7 +717,7 @@ cf_lex_symbol(const char *data)
static void
cf_lex_init_kh(void)
{
- HASH_INIT(kw_hash, &root_pool, KW_ORDER);
+ HASH_INIT(kw_hash, config_pool, KW_ORDER);
struct keyword *k;
for (k=keyword_list; k->name; k++)
diff --git a/conf/conf.c b/conf/conf.c
index 025c040e..11c136e7 100644
--- a/conf/conf.c
+++ b/conf/conf.c
@@ -61,6 +61,7 @@
static jmp_buf conf_jmpbuf;
struct config *config, *new_config;
+pool *config_pool;
static struct config *old_config; /* Old configuration */
static struct config *future_config; /* New config held here if recon requested during recon */
@@ -89,7 +90,7 @@ int undo_available; /* Undo was not requested from last reconfiguration */
struct config *
config_alloc(const char *name)
{
- pool *p = rp_new(&root_pool, "Config");
+ pool *p = rp_new(config_pool, "Config");
linpool *l = lp_new_default(p);
struct config *c = lp_allocz(l, sizeof(struct config));
@@ -491,10 +492,12 @@ config_timeout(timer *t UNUSED)
void
config_init(void)
{
- config_event = ev_new(&root_pool);
+ config_pool = rp_new(&root_pool, "Configurations");
+
+ config_event = ev_new(config_pool);
config_event->hook = config_done;
- config_timer = tm_new(&root_pool);
+ config_timer = tm_new(config_pool);
config_timer->hook = config_timeout;
}
diff --git a/conf/conf.h b/conf/conf.h
index 96c873df..5ec924b0 100644
--- a/conf/conf.h
+++ b/conf/conf.h
@@ -96,7 +96,7 @@ void order_shutdown(int gr);
/* Pools */
-
+extern pool *config_pool;
extern linpool *cfg_mem;
#define cfg_alloc(size) lp_alloc(cfg_mem, size)
diff --git a/conf/flowspec.Y b/conf/flowspec.Y
index dbdbdda5..102fed45 100644
--- a/conf/flowspec.Y
+++ b/conf/flowspec.Y
@@ -180,7 +180,7 @@ flow6_opts:
flow_builder_init:
{
if (this_flow == NULL)
- this_flow = flow_builder_init(&root_pool);
+ this_flow = flow_builder_init(config_pool); /* FIXME: This should be allocated from tmp in future */
else
flow_builder_clear(this_flow);
};