core/vm: clear memory

This commit is contained in:
MariusVanDerWijden 2025-11-10 09:41:21 +01:00
parent 8c5a76e541
commit c51e1b54a5

View file

@ -44,6 +44,7 @@ func (m *Memory) Free() {
// To reduce peak allocation, return only smaller memory instances to the pool. // To reduce peak allocation, return only smaller memory instances to the pool.
const maxBufferSize = 16 << 10 const maxBufferSize = 16 << 10
if cap(m.store) <= maxBufferSize { if cap(m.store) <= maxBufferSize {
clear(m.store)
m.store = m.store[:0] m.store = m.store[:0]
m.lastGasCost = 0 m.lastGasCost = 0
memoryPool.Put(m) memoryPool.Put(m)