pool: clear idle state references on acquire

Prevent the idle slice's backing array from retaining discarded states.
This commit is contained in:
Meo597
2026-10-05 08:37:12 +08:00
parent 52be8f8170
commit 103f5cbfdb
+1
View File
@@ -69,6 +69,7 @@ func (p *Pool) Acquire(ctx context.Context) (*glua.LState, error) {
n := len(p.idle)
if n != 0 {
state := p.idle[n-1]
p.idle[n-1] = nil
p.idle = p.idle[:n-1]
p.mu.Unlock()
return state, nil