Skip to content

Commit

Permalink
Reduce glibc fragmentation Part 2 (netdata#19390)
Browse files Browse the repository at this point in the history
* dictionary uses exclusively aral for allocations, except when the dictionary is variable sized

* make all fixed size dictionaries use flag DICT_OPTION_FIXED_SIZE

* memory accounting for rrd memory slots

* use aral for extents

* extent page sizes per KiB

* test to see if 4KiB is better than 1KiB
  • Loading branch information
ktsaou authored Jan 13, 2025
1 parent db31a10 commit e2e008e
Show file tree
Hide file tree
Showing 23 changed files with 114 additions and 49 deletions.
2 changes: 1 addition & 1 deletion src/collectors/cups.plugin/cups_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ int main(int argc, char **argv) {

errno_clear();

dict_dest_job_metrics = dictionary_create(DICT_OPTION_SINGLE_THREADED);
dict_dest_job_metrics = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct job_metrics));

// ------------------------------------------------------------------------
// the main loop
Expand Down
2 changes: 1 addition & 1 deletion src/collectors/debugfs.plugin/module-libsensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ void *libsensors_thread(void *ptr __maybe_unused) {
}
if(fp) fclose(fp);

sensors_dict = dictionary_create(DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_SINGLE_THREADED);
sensors_dict = dictionary_create_advanced(DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_SINGLE_THREADED | DICT_OPTION_FIXED_SIZE, NULL, sizeof(SENSOR));

// preflight to check data collection latency
{
Expand Down
2 changes: 1 addition & 1 deletion src/collectors/diskspace.plugin/plugin_diskspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
SIMPLE_PATTERN_EXACT,
true);
dict_mountpoints = dictionary_create_advanced(DICT_OPTION_NONE, &dictionary_stats_category_collectors, 0);
dict_mountpoints = dictionary_create_advanced(DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(struct mount_point_metadata));
dictionary_register_delete_callback(dict_mountpoints, mountpoint_delete_cb, NULL);
}
Expand Down
2 changes: 1 addition & 1 deletion src/collectors/proc.plugin/sys_block_zram.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ int do_sys_block_zram(int update_every, usec_t dt) {
}
procfile_close(ff);

devices = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED, &dictionary_stats_category_collectors, 0);
devices = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(ZRAM_DEVICE));
device_count = init_devices(devices, update_every);
}

Expand Down
4 changes: 2 additions & 2 deletions src/collectors/proc.plugin/sys_devices_pci_aer.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static bool aer_value_conflict_callback(const DICTIONARY_ITEM *item __maybe_unus

static void aer_insert_callback(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
struct aer_entry *a = value;
a->values = dictionary_create(DICT_OPTION_SINGLE_THREADED|DICT_OPTION_DONT_OVERWRITE_VALUE);
a->values = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED|DICT_OPTION_DONT_OVERWRITE_VALUE|DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(struct aer_value));
dictionary_register_conflict_callback(a->values, aer_value_conflict_callback, NULL);
}

Expand Down Expand Up @@ -209,7 +209,7 @@ int do_proc_sys_devices_pci_aer(int update_every, usec_t dt __maybe_unused) {
if(!do_root_ports && !do_pci_slots)
return 1;

aer_root = dictionary_create(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE);
aer_root = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(struct aer_entry));
dictionary_register_insert_callback(aer_root, aer_insert_callback, NULL);

AER_TYPE types = ((do_root_ports) ? (AER_ROOTPORT_TOTAL_ERR_COR|AER_ROOTPORT_TOTAL_ERR_FATAL) : 0) |
Expand Down
16 changes: 8 additions & 8 deletions src/collectors/statsd.plugin/statsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ static inline void statsd_process_dictionary(STATSD_METRIC *m, const char *value
statsd_reset_metric(m);

if (unlikely(!m->dictionary.dict))
m->dictionary.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors, 0);
m->dictionary.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(STATSD_METRIC_DICTIONARY_ITEM));

if(unlikely(value_is_zinit(value))) {
// magic loading of metric, without affecting anything
Expand Down Expand Up @@ -2455,13 +2455,13 @@ void *statsd_main(void *ptr) {
worker_register_job_name(WORKER_STATSD_FLUSH_DICTIONARIES, "dictionaries");
worker_register_job_name(WORKER_STATSD_FLUSH_STATS, "statistics");

statsd.gauges.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors, 0);
statsd.meters.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors, 0);
statsd.counters.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors, 0);
statsd.histograms.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors, 0);
statsd.dictionaries.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors, 0);
statsd.sets.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors, 0);
statsd.timers.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS, &dictionary_stats_category_collectors, 0);
statsd.gauges.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(STATSD_METRIC));
statsd.meters.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(STATSD_METRIC));
statsd.counters.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(STATSD_METRIC));
statsd.histograms.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(STATSD_METRIC));
statsd.dictionaries.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(STATSD_METRIC));
statsd.sets.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(STATSD_METRIC));
statsd.timers.dict = dictionary_create_advanced(STATSD_DICTIONARY_OPTIONS | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(STATSD_METRIC));

dictionary_register_insert_callback(statsd.gauges.dict, dictionary_metric_insert_callback, &statsd.gauges);
dictionary_register_insert_callback(statsd.meters.dict, dictionary_metric_insert_callback, &statsd.meters);
Expand Down
4 changes: 2 additions & 2 deletions src/collectors/tc.plugin/plugin_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static bool tc_class_conflict_callback(const DICTIONARY_ITEM *item __maybe_unuse

static void tc_class_index_init(struct tc_device *d) {
if(!d->classes) {
d->classes = dictionary_create_advanced(DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_SINGLE_THREADED, &dictionary_stats_category_collectors, 0);
d->classes = dictionary_create_advanced(DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_SINGLE_THREADED | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_collectors, sizeof(struct tc_class));

dictionary_register_delete_callback(d->classes, tc_class_free_callback, d);
dictionary_register_conflict_callback(d->classes, tc_class_conflict_callback, d);
Expand All @@ -111,7 +111,7 @@ static void tc_class_index_destroy(struct tc_device *d) {
}

static struct tc_class *tc_class_index_add(struct tc_device *d, struct tc_class *c) {
return dictionary_set(d->classes, string2str(c->id), c, sizeof(*c));
return dictionary_set(d->classes, string2str(c->id), c, sizeof(struct tc_class));
}

static void tc_class_index_del(struct tc_device *d, struct tc_class *c) {
Expand Down
2 changes: 1 addition & 1 deletion src/daemon/dyncfg/dyncfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static bool dyncfg_conflict_cb(const DICTIONARY_ITEM *item __maybe_unused, void

void dyncfg_init_low_level(bool load_saved) {
if(!dyncfg_globals.nodes) {
dyncfg_globals.nodes = dictionary_create_advanced(DICT_OPTION_FIXED_SIZE | DICT_OPTION_DONT_OVERWRITE_VALUE, NULL, sizeof(DYNCFG));
dyncfg_globals.nodes = dictionary_create_advanced(DICT_OPTION_FIXED_SIZE | DICT_OPTION_DONT_OVERWRITE_VALUE, &dictionary_stats_category_dyncfg, sizeof(DYNCFG));
dictionary_register_insert_callback(dyncfg_globals.nodes, dyncfg_insert_cb, NULL);
dictionary_register_react_callback(dyncfg_globals.nodes, dyncfg_react_cb, NULL);
dictionary_register_conflict_callback(dyncfg_globals.nodes, dyncfg_conflict_cb, NULL);
Expand Down
15 changes: 15 additions & 0 deletions src/daemon/pulse/pulse-daemon-memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
#include "pulse-daemon-memory.h"
#include "streaming/stream-replication-sender.h"

static size_t rrd_slot_memory = 0;

void rrd_slot_memory_added(size_t added) {
__atomic_add_fetch(&rrd_slot_memory, added, __ATOMIC_RELAXED);
}

void rrd_slot_memory_removed(size_t added) {
__atomic_sub_fetch(&rrd_slot_memory, added, __ATOMIC_RELAXED);
}

#define dictionary_stats_memory_total(stats) \
((stats).memory.dict + (stats).memory.values + (stats).memory.index)

Expand Down Expand Up @@ -38,6 +48,7 @@ void pulse_daemon_memory_do(bool extended) {
static RRDDIM *rd_workers = NULL;
static RRDDIM *rd_aral = NULL;
static RRDDIM *rd_judy = NULL;
static RRDDIM *rd_slots = NULL;
static RRDDIM *rd_other = NULL;

if (unlikely(!st_memory)) {
Expand Down Expand Up @@ -79,6 +90,7 @@ void pulse_daemon_memory_do(bool extended) {
rd_workers = rrddim_add(st_memory, "workers", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
rd_aral = rrddim_add(st_memory, "aral", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
rd_judy = rrddim_add(st_memory, "judy", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
rd_slots = rrddim_add(st_memory, "slots", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
rd_other = rrddim_add(st_memory, "other", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
}

Expand Down Expand Up @@ -172,6 +184,9 @@ void pulse_daemon_memory_do(bool extended) {
rrddim_set_by_pointer(st_memory, rd_judy,
(collected_number) judy_aral_structures());

rrddim_set_by_pointer(st_memory, rd_slots,
(collected_number)__atomic_load_n(&rrd_slot_memory, __ATOMIC_RELAXED));

rrddim_set_by_pointer(st_memory, rd_other,
(collected_number)dictionary_stats_memory_total(dictionary_stats_category_other));

Expand Down
3 changes: 3 additions & 0 deletions src/daemon/pulse/pulse-daemon-memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ extern struct netdata_buffers_statistics {
void pulse_daemon_memory_do(bool extended);
#endif

void rrd_slot_memory_added(size_t added);
void rrd_slot_memory_removed(size_t added);

#endif //NETDATA_PULSE_DAEMON_MEMORY_H
2 changes: 2 additions & 0 deletions src/daemon/pulse/pulse-dictionary.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ struct dictionary_stats dictionary_stats_category_rrdlabels = { .name = "labels"
struct dictionary_stats dictionary_stats_category_rrdhealth = { .name = "health" };
struct dictionary_stats dictionary_stats_category_functions = { .name = "functions" };
struct dictionary_stats dictionary_stats_category_replication = { .name = "replication" };
struct dictionary_stats dictionary_stats_category_dyncfg = { .name = "dyncfg" };

#ifdef DICT_WITH_STATS
struct dictionary_categories {
Expand Down Expand Up @@ -64,6 +65,7 @@ struct dictionary_categories {
{ .stats = &dictionary_stats_category_rrdhealth, },
{ .stats = &dictionary_stats_category_functions, },
{ .stats = &dictionary_stats_category_replication, },
{ .stats = &dictionary_stats_category_dyncfg, },
{ .stats = &dictionary_stats_category_other, },

// terminator
Expand Down
1 change: 1 addition & 0 deletions src/daemon/pulse/pulse-dictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ extern struct dictionary_stats dictionary_stats_category_rrdlabels;
extern struct dictionary_stats dictionary_stats_category_rrdhealth;
extern struct dictionary_stats dictionary_stats_category_functions;
extern struct dictionary_stats dictionary_stats_category_replication;
extern struct dictionary_stats dictionary_stats_category_dyncfg;

#if defined(PULSE_INTERNALS)
void pulse_dictionary_do(bool extended);
Expand Down
1 change: 1 addition & 0 deletions src/database/contexts/api_v2_contexts_alert_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,6 @@ int contexts_v2_alert_config_to_json(struct web_client *w, const char *config_ha
}
}

dictionary_destroy(configs);
return ret;
}
34 changes: 27 additions & 7 deletions src/database/engine/page.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,23 @@ static size_t aral_sizes[] = {
sizeof(gorilla_writer_t),
sizeof(PGD),

512, 1024, 1536, 2048, 5 * 512, 6 * 512, 7 * 512,
4 * 1024, 8 * 1024, 12 * 1024, 16 * 1024, 20 * 1024,
24 * 1024, 28 * 1024, 32 * 1024, 36 * 1024, 40 * 1024,
44 * 1024, 48 * 1024, 52 * 1024, 56 * 1024, 60 * 1024,
64 * 1024, 68 * 1024, 72 * 1024, 76 * 1024, 80 * 1024,
84 * 1024, 88 * 1024, 92 * 1024, 96 * 1024, 100 * 1024,
104 * 1024, 108 * 1024, 112 * 1024, 116 * 1024, 120 * 1024,
// per 512B
512, 1024, 1536, 2048, 5 * 512, 6 * 512, 7 * 512, 8 * 512, /* 9 * 512, */

// per 1KiB
// 5 * 1024, 6 * 1024, 7 * 1024, 8 * 1024, 9 * 1024, 10 * 1024, 11 * 1024,
// 12 * 1024, 13 * 1024, 14 * 1024, 15 * 1024, 16 * 1024, 17 * 1024, 18 * 1024,
// 19 * 1024, 20 * 1024, 21 * 1024, 22 * 1024, 23 * 1024, 24 * 1024, 25 * 1024,
// 26 * 1024, 27 * 1024, 28 * 1024, 29 * 1024, 30 * 1024, 31 * 1024, 32 * 1024,

// test to see if 4KiB has less overheads than 1KiB
8 * 1024, 12 * 1024, 16 * 1024, 20 * 1024, 24 * 1024, 28 * 1024, 32 * 1024,

// per 4KiB
36 * 1024, 40 * 1024, 44 * 1024, 48 * 1024, 52 * 1024, 56 * 1024, 60 * 1024,
64 * 1024, 68 * 1024, 72 * 1024, 76 * 1024, 80 * 1024, 84 * 1024, 88 * 1024,
92 * 1024, 96 * 1024, 100 * 1024, 104 * 1024, 108 * 1024, 112 * 1024, 116 * 1024,
120 * 1024, 124 * 1024, 128 * 1024,
};
static ARAL **arals = NULL;

Expand Down Expand Up @@ -317,6 +327,16 @@ static size_t pgd_data_footprint(size_t size, size_t partition) {
return size;
}

// ----------------------------------------------------------------------------

void *dbengine_extent_alloc(size_t size) {
return pgd_data_alloc(size, 0, false);
}

void dbengine_extent_free(void *extent, size_t size) {
pgd_data_free(extent, size, 0);
}

// ----------------------------------------------------------------------------
// management api

Expand Down
3 changes: 3 additions & 0 deletions src/database/engine/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ size_t pgd_append_point(PGD *pg,
void pgdc_reset(PGDC *pgdc, PGD *pgd, uint32_t position);
bool pgdc_get_next_point(PGDC *pgdc, uint32_t expected_position, STORAGE_POINT *sp);

void *dbengine_extent_alloc(size_t size);
void dbengine_extent_free(void *extent, size_t size);

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 0 additions & 2 deletions src/database/engine/pdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1288,12 +1288,10 @@ void epdl_find_extent_and_populate_pages(struct rrdengine_instance *ctx, EPDL *e
void *extent_data = datafile_extent_read(ctx, epdl->file, epdl->extent_offset, epdl->extent_size);
if(extent_data != NULL) {

#if defined(NETDATA_TRACE_ALLOCATIONS)
void *tmp = dbengine_extent_alloc(epdl->extent_size);
memcpy(tmp, extent_data, epdl->extent_size);
datafile_extent_read_free(extent_data);
extent_data = tmp;
#endif

if(worker)
worker_is_busy(UV_EVENT_DBENGINE_EXTENT_CACHE_LOOKUP);
Expand Down
9 changes: 0 additions & 9 deletions src/database/engine/rrdengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,15 +584,6 @@ static inline struct rrdeng_cmd rrdeng_deq_cmd(bool from_worker) {

// ----------------------------------------------------------------------------

void *dbengine_extent_alloc(size_t size) {
void *extent = mallocz(size);
return extent;
}

void dbengine_extent_free(void *extent, size_t size __maybe_unused) {
freez(extent);
}

static void journalfile_extent_build(struct rrdengine_instance *ctx, struct extent_io_descriptor *xt_io_descr) {
unsigned count, payload_length, descr_size, size_bytes;
void *buf;
Expand Down
3 changes: 0 additions & 3 deletions src/database/engine/rrdengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,6 @@ static inline void ctx_last_flush_fileno_set(struct rrdengine_instance *ctx, uns

#define ctx_is_available_for_queries(ctx) (__atomic_load_n(&(ctx)->quiesce.enabled, __ATOMIC_RELAXED) == false && __atomic_load_n(&(ctx)->quiesce.exit_mode, __ATOMIC_RELAXED) == false)

void *dbengine_extent_alloc(size_t size);
void dbengine_extent_free(void *extent, size_t size);

bool rrdeng_ctx_tier_cap_exceeded(struct rrdengine_instance *ctx);
int init_rrd_files(struct rrdengine_instance *ctx);
void finalize_rrd_files(struct rrdengine_instance *ctx);
Expand Down
15 changes: 11 additions & 4 deletions src/database/rrdset.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ static void rrdset_stream_send_chart_slot_release(RRDSET *st) {
spinlock_lock(&host->stream.snd.pluginsd_chart_slots.available.spinlock);

if(host->stream.snd.pluginsd_chart_slots.available.used >= host->stream.snd.pluginsd_chart_slots.available.size) {
uint32_t old_size = host->stream.snd.pluginsd_chart_slots.available.size;
uint32_t new_size = (old_size > 0) ? (old_size * 2) : 1024;
uint32_t old_slots = host->stream.snd.pluginsd_chart_slots.available.size;
uint32_t new_slots = (old_slots > 0) ? (old_slots * 2) : 1024;

host->stream.snd.pluginsd_chart_slots.available.array =
reallocz(host->stream.snd.pluginsd_chart_slots.available.array, new_size * sizeof(uint32_t));
reallocz(host->stream.snd.pluginsd_chart_slots.available.array, new_slots * sizeof(uint32_t));

host->stream.snd.pluginsd_chart_slots.available.size = new_size;
host->stream.snd.pluginsd_chart_slots.available.size = new_slots;

rrd_slot_memory_added((new_slots - old_slots) * sizeof(uint32_t));
}

host->stream.snd.pluginsd_chart_slots.available.array[host->stream.snd.pluginsd_chart_slots.available.used++] =
Expand All @@ -51,6 +53,8 @@ static void rrdset_stream_send_chart_slot_release(RRDSET *st) {
}

void rrdhost_pluginsd_send_chart_slots_free(RRDHOST *host) {
rrd_slot_memory_removed(host->stream.snd.pluginsd_chart_slots.available.size * sizeof(uint32_t));

spinlock_lock(&host->stream.snd.pluginsd_chart_slots.available.spinlock);
host->stream.snd.pluginsd_chart_slots.available.ignore = true;
freez(host->stream.snd.pluginsd_chart_slots.available.array);
Expand Down Expand Up @@ -95,6 +99,7 @@ void rrdset_pluginsd_receive_unslot_and_cleanup(RRDSET *st) {

rrdset_pluginsd_receive_unslot(st);

rrd_slot_memory_removed(st->pluginsd.size * sizeof(struct pluginsd_rrddim));
freez(st->pluginsd.prd_array);
st->pluginsd.prd_array = NULL;
st->pluginsd.size = 0;
Expand All @@ -113,6 +118,8 @@ static void rrdset_pluginsd_receive_slots_initialize(RRDSET *st) {
}

void rrdhost_pluginsd_receive_chart_slots_free(RRDHOST *host) {
rrd_slot_memory_removed(host->stream.rcv.pluginsd_chart_slots.size * sizeof(uint32_t));

spinlock_lock(&host->stream.rcv.pluginsd_chart_slots.spinlock);

if(host->stream.rcv.pluginsd_chart_slots.array) {
Expand Down
4 changes: 2 additions & 2 deletions src/health/health_prototypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ void health_init_prototypes(void) {
if(health_globals.prototypes.dict)
return;

health_globals.prototypes.dict = dictionary_create(DICT_OPTION_DONT_OVERWRITE_VALUE);
health_globals.prototypes.dict = dictionary_create_advanced(DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, &dictionary_stats_category_rrdhealth, sizeof(RRD_ALERT_PROTOTYPE));
dictionary_register_insert_callback(health_globals.prototypes.dict, health_prototype_insert_cb, NULL);
dictionary_register_conflict_callback(health_globals.prototypes.dict, health_prototype_conflict_cb, NULL);
dictionary_register_delete_callback(health_globals.prototypes.dict, health_prototype_delete_cb, NULL);
Expand Down Expand Up @@ -472,7 +472,7 @@ bool health_prototype_add(RRD_ALERT_PROTOTYPE *ap, char **msg) {
// add it to the prototypes
dictionary_set_advanced(health_globals.prototypes.dict,
string2str(ap->config.name), string_strlen(ap->config.name),
ap, sizeof(*ap),
ap, sizeof(RRD_ALERT_PROTOTYPE),
NULL);

return true;
Expand Down
Loading

0 comments on commit e2e008e

Please sign in to comment.