Skip to content

Conversation

@Almasty
Copy link

@Almasty Almasty commented May 17, 2016

Maintain server array on server metric addition or removal
Set socket IO metrics on connection to the server when metrics collection is activated

src/metrics.cc Outdated
entries.push_back(ent);
raw_entries.push_back(ent);
nservers = entries.size();
servers = (const lcb_SERVERMETRICS**) realloc(servers, nservers * sizeof(*servers));
Copy link
Owner

@mnunberg mnunberg May 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

servers = &raw_entries[0];

Because that's the only place we actually modify the vector, any references pointing to its elements should be considered valid until the vector is updated again (i.e. in this same function).

No need for realloc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants