Commit 61d7a8e
authored
in_tail: reduce memory usage slightly (#4881)
**Which issue(s) this PR fixes**:
Fixes #
**What this PR does / why we need it**:
Previous, I changed lifespan of `iobuf` at
#4763 to work GC collector well.
In addition, it seems that clearing `iobuf` manually when it is no
longer needed, it might improve memory efficiency.

* config
```
<source>
@type tail
path "#{File.expand_path '~/tmp/access*.log'}"
pos_file "#{File.expand_path '~/tmp/fluentd/access.log.pos'}"
tag log
refresh_interval 5s
<parse>
@type none
</parse>
</source>
<match **>
@type file
path "#{File.expand_path '~/tmp/log'}"
</match>
```
* script to generate log data
```
require "json"
path = File.expand_path("~/tmp/access.log")
File.open(path, "w") do |f|
loop do
log = { time: Time.now, message: "a" * 10_000 }.to_json
f.puts log
sleep 0.05
end
end
```
Related to #4808
**Docs Changes**:
**Release Note**:
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>1 parent 5c86e31 commit 61d7a8e
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1238 | 1238 | | |
1239 | 1239 | | |
1240 | 1240 | | |
| 1241 | + | |
| 1242 | + | |
1241 | 1243 | | |
1242 | 1244 | | |
1243 | 1245 | | |
| |||
0 commit comments