index 128f3c444afe0bdde1d75331532f73ea388df0c2..9b8d9ee30cb59ae59d8d27de6b96f4b0a72cde95 100644 (file)
--- a/program/src/rrd_daemon.c
+++ b/program/src/rrd_daemon.c
{
char *file;
char **values;
- size_t values_num;
+ size_t values_num; /* number of valid pointers */
+ size_t values_alloc; /* number of allocated pointers */
time_t last_flush_time;
time_t last_update_stamp;
#define CI_FLAGS_IN_TREE (1<<0)
static char *config_base_dir = NULL;
static size_t _config_base_dir_len = 0;
static int config_write_base_only = 0;
+static size_t config_alloc_chunk = 1;
static listen_socket_t **config_listen_address_list = NULL;
static size_t config_listen_address_list_len = 0;
{
ci->values = NULL;
ci->values_num = 0;
+ ci->values_alloc = 0;
ci->last_flush_time = when;
if (config_write_jitter > 0)
else
ci->last_update_stamp = stamp;
- if (!rrd_add_strdup(&ci->values, &ci->values_num, value))
+ if (!rrd_add_strdup_chunk(&ci->values, &ci->values_num, value,
+ &ci->values_alloc, config_alloc_chunk))
{
RRDD_LOG (LOG_ERR, "handle_request_update: rrd_add_strdup failed.");
continue;
gid_t socket_group = (gid_t)-1;
mode_t socket_permissions = (mode_t)-1;
- while ((option = getopt(argc, argv, "gl:s:m:P:f:w:z:t:Bb:p:Fj:h?")) != -1)
+ while ((option = getopt(argc, argv, "gl:s:m:P:f:w:z:t:Bb:p:Fj:m:h?")) != -1)
{
switch (option)
{
}
break;
+ case 'm':
+ {
+ int temp = atoi(optarg);
+ if (temp > 0)
+ config_alloc_chunk = temp;
+ else
+ {
+ fprintf(stderr, "Invalid allocation size: %s\n", optarg);
+ status = 10;
+ }
+ }
+ break;
+
case 'h':
case '?':
printf ("RRDCacheD %s\n"