Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer represents the reuse buffer.
func (*Buffer) AllocBytes ¶
AllocBytes allocates bytes with the given length.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool is like `sync.Pool`, which manages memory for all bytes buffers.
NOTE: we don't used a `sync.Pool` because when will sync.Pool release is depending on the garbage collector which always release the memory so late. Use a fixed size chan to reuse can decrease the memory usage to 1/3 compare with sync.Pool.
Click to show internal directories.
Click to hide internal directories.