diff --git a/perfmap.go b/perfmap.go index 749c105..d5eb755 100644 --- a/perfmap.go +++ b/perfmap.go @@ -264,6 +264,8 @@ func (m *PerfMap) Resume() error { // BufferSize is the size in bytes of each per-CPU buffer func (m *PerfMap) BufferSize() int { + m.stateLock.Lock() + defer m.stateLock.Unlock() return m.bufferSize } diff --git a/ringbuffer.go b/ringbuffer.go index 89713f3..03777a4 100644 --- a/ringbuffer.go +++ b/ringbuffer.go @@ -185,6 +185,8 @@ func (rb *RingBuffer) Stop(cleanup MapCleanupType) error { // BufferSize returns the size in bytes of the ring buffer func (rb *RingBuffer) BufferSize() int { + rb.stateLock.Lock() + defer rb.stateLock.Unlock() return rb.bufferSize }