Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 1.23 KB

README.md

File metadata and controls

39 lines (27 loc) · 1.23 KB

GoDoc Build Status

Rebytes – Recycled byte slice pool and buffer for Golang

Synopsis

    // Byte slice pool with 1k slice capacity, 100 pool capacity
    pool := rebytes.NewPool(1024, 100)
    byteSlice := pool.Get()
    pool.Put(byteSlice)

    // Like bytes.Buffer, but with dynamic memory managed by the pool
    buf, err := rebytes.NewBuffer(pool)
    buf.WriteString("Hello World")

Status

This software is considered ALPHA quality. Not recommended for production use.

Description

Package rebytes provides types that recycle bytes slices to reduce allocation and garbage collection:

  • rebytes.Pool: a []byte pool that provides/recycles fixed capacity slices from a fixed-maximum-size pool.
  • rebytes.Buffer: a bytes.Buffer analogue that dynamically gets/returns memory from a rebytes.Pool.

Copyright and License

Copyright 2017 by David A. Golden. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"). You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0