Skip to content

Commit

Permalink
Add guards
Browse files Browse the repository at this point in the history
  • Loading branch information
arjan-bal committed Jan 22, 2025
1 parent d2d87a7 commit aa0b47d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mem/buffers.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ func IsBelowBufferPoolingThreshold(size int) bool {
type buffer struct {
origData *[]byte
data []byte
guardStart [8]byte
refs *atomic.Int32
guardEnd [8]byte
pool BufferPool
freeCallers []string
refCallers []string
Expand Down Expand Up @@ -171,6 +173,8 @@ func (b *buffer) Free() {
b.freeCallers = nil
bufferObjectPool.Put(b)
default:
expected := [8]byte{}
fmt.Println("Guards:", expected == b.guardStart, expected == b.guardEnd)
op := fmt.Sprintf("refCount: %d\nFree callers", refs)
for _, c := range b.freeCallers {
op = op + "\n\n" + c
Expand Down

0 comments on commit aa0b47d

Please sign in to comment.