Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use bytes.Buffer instead of simple string concat #78

Merged
merged 1 commit into from
Aug 28, 2020

Conversation

haojhcwa
Copy link
Contributor

Description of the issue

Log message is concatenated using "+" operator, which would always allocate memory upon execution.

Description of changes

Use bytes.Buffer to reduce the memory allocation needed.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

Unit tests

cnt++
}

if cnt < 5 {
continue
}

msg := msgBuf.String()
e := &LogEvent{
msg: msg,
Copy link
Contributor

Choose a reason for hiding this comment

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

use msgBuf.String()?

@haojhcwa haojhcwa merged commit ab08706 into aws:master Aug 28, 2020
sky333999 pushed a commit that referenced this pull request Jul 21, 2023
Fix log file monitoring without any metrics collected.
Change config-translator to exit with code 0 and delete YAML config if there is no pipeline in the YAML.
Change amazon-cloudwatch-agent to start Telegraf framework when YAML does not exist.
dchappa pushed a commit that referenced this pull request Sep 3, 2024
Co-authored-by: Seth L <81644108+sethAmazon@users.noreply.github.com>
Co-authored-by: Chad Patel <chadpatel@users.noreply.github.com>
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