rs / zerolog

Zero Allocation JSON Logger
MIT License
10.33k stars 564 forks source link

Question: Using Dict Inside an Array would not put back the byte buffer back into pool, is this the expectation? #681

Open ramnad-motorq opened 1 month ago

ramnad-motorq commented 1 month ago

If I try to run this program after instrumenting calls to eventPool.New and putEvent, I see that we won't put back the Dict created back into the eventPool.

We do use putEvent, if a Dict is applied directly to an Event.

I am new to this library and am trying to understand its implementation, so my question is if I am missing something here and this is actually the expectation?

package main

import (
    "github.com/rs/zerolog"
    "github.com/rs/zerolog/log"
)

func main() {
    log.Debug().Array("arr", zerolog.Arr().Dict(zerolog.Dict().Str("key", "value"))).Msg("arrayTest")
}