diff options
| author | Paul Buetow <paul@buetow.org> | 2021-10-09 21:10:29 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-10-10 13:36:41 +0300 |
| commit | ea1de3044e129d419f4e807f2624a009343a128f (patch) | |
| tree | 9ff1335ca26afc90e55fd6de416457e252d75a35 /internal/io/pool/bytesbuffer.go | |
| parent | 7563abe9d5beaa18fa1eab0f65668f5dfcf79052 (diff) | |
vetting and linting and some code restyling
Diffstat (limited to 'internal/io/pool/bytesbuffer.go')
| -rw-r--r-- | internal/io/pool/bytesbuffer.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/io/pool/bytesbuffer.go b/internal/io/pool/bytesbuffer.go index 0a159f5..3d48f2c 100644 --- a/internal/io/pool/bytesbuffer.go +++ b/internal/io/pool/bytesbuffer.go @@ -5,6 +5,8 @@ import ( "sync" ) +// BytesBuffer is there to optimize memory allocations. DTail otherwise allocates +// a lot of memory while reading logs. var BytesBuffer = sync.Pool{ New: func() interface{} { b := bytes.Buffer{} @@ -13,6 +15,7 @@ var BytesBuffer = sync.Pool{ }, } +// RecycleBytesBuffer recycles the buffer again. func RecycleBytesBuffer(b *bytes.Buffer) { b.Reset() BytesBuffer.Put(b) |
