Documentation
¶
Overview ¶
Package mpool provides recycleable memory buffer to reduce gc.
Based upon slab class allocation algorithm.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorMessageOverflow = errors.New("message overflow")
Functions ¶
func AccessLogLineBufferGet ¶
func AccessLogLineBufferGet() []byte
func AccessLogLineBufferPut ¶
func AccessLogLineBufferPut(b []byte)
func BytesBufferGet ¶
func BytesBufferPut ¶
Types ¶
type Message ¶
type Message struct { Body []byte // contains filtered or unexported fields }
Message encapsulates the messages that we exchange back and forth.
func NewMessage ¶
NewMessage is the supported way to obtain a new Message. This makes use of a "slab allocator" which greatly reduces the load on the garbage collector.
func (*Message) Free ¶
Free decrements the reference count on a message, and releases its resources if no further references remain. While this is not strictly necessary thanks to GC, doing so allows for the resources to be recycled without engaging GC. This can have rather substantial benefits for performance.
Click to show internal directories.
Click to hide internal directories.