summaryrefslogtreecommitdiffstats
path: root/registry/registry_machine.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-09 04:52:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-09 04:52:39 +0000
commit89f3604407aff8f4cb2ed958252c61e23c767e24 (patch)
tree7fbf408102cab051557d38193524d8c6e991d070 /registry/registry_machine.c
parentAdding upstream version 1.34.1. (diff)
downloadnetdata-89f3604407aff8f4cb2ed958252c61e23c767e24.tar.xz
netdata-89f3604407aff8f4cb2ed958252c61e23c767e24.zip
Adding upstream version 1.35.0.upstream/1.35.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'registry/registry_machine.c')
-rw-r--r--registry/registry_machine.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/registry/registry_machine.c b/registry/registry_machine.c
index bd1d243a0..fb345aea2 100644
--- a/registry/registry_machine.c
+++ b/registry/registry_machine.c
@@ -24,7 +24,10 @@ REGISTRY_MACHINE_URL *registry_machine_url_allocate(REGISTRY_MACHINE *m, REGISTR
registry.machines_urls_memory += sizeof(REGISTRY_MACHINE_URL);
debug(D_REGISTRY, "registry_machine_url_allocate('%s', '%s'): indexing URL in machine", m->guid, u->url);
+
+ registry.machines_urls_memory -= dictionary_stats_allocated_memory(m->machine_urls);
dictionary_set(m->machine_urls, u->url, mu, sizeof(REGISTRY_MACHINE_URL));
+ registry.machines_urls_memory += dictionary_stats_allocated_memory(m->machine_urls);
registry_url_link(u);
@@ -39,15 +42,17 @@ REGISTRY_MACHINE *registry_machine_allocate(const char *machine_guid, time_t whe
strncpyz(m->guid, machine_guid, GUID_LEN);
debug(D_REGISTRY, "Registry: registry_machine_allocate('%s'): creating dictionary of urls", machine_guid);
- m->machine_urls = dictionary_create(DICTIONARY_FLAGS);
+ m->machine_urls = dictionary_create(REGISTRY_DICTIONARY_FLAGS);
m->first_t = m->last_t = (uint32_t)when;
m->usages = 0;
registry.machines_memory += sizeof(REGISTRY_MACHINE);
-
registry.machines_count++;
+
+ registry.machines_urls_memory -= dictionary_stats_allocated_memory(m->machine_urls);
dictionary_set(registry.machines, m->guid, m, sizeof(REGISTRY_MACHINE));
+ registry.machines_urls_memory += dictionary_stats_allocated_memory(m->machine_urls);
return m;
}