move niling of trace buffer to the end
this avoids holding on memory while we are waiting.
This commit is contained in:
parent
91527e2d10
commit
24a1181b9a
10
tracer.go
10
tracer.go
|
@ -187,11 +187,6 @@ func (t *RemoteTracer) doWrite() {
|
||||||
for {
|
for {
|
||||||
_, ok := <-t.ch
|
_, ok := <-t.ch
|
||||||
|
|
||||||
// nil out the buffer to gc events when swapping buffers
|
|
||||||
for i := range buf {
|
|
||||||
buf[i] = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// wait a bit to accumulate a batch
|
// wait a bit to accumulate a batch
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
|
|
||||||
|
@ -220,6 +215,11 @@ func (t *RemoteTracer) doWrite() {
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
// nil out the buffer to gc consumed events
|
||||||
|
for i := range buf {
|
||||||
|
buf[i] = nil
|
||||||
|
}
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.Reset()
|
s.Reset()
|
||||||
|
|
Loading…
Reference in New Issue