mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
internal/graphicscommand: Bug fix: memory leak at q.commands
Apparently, the part of a slice between len and cap-1 still holds references. Release them explicitly. Closes #1803
This commit is contained in:
parent
8f857daf3e
commit
5ac357959c
@ -292,6 +292,13 @@ func (q *commandQueue) flush() error {
|
|||||||
cs = cs[nc:]
|
cs = cs[nc:]
|
||||||
}
|
}
|
||||||
theGraphicsDriver.End()
|
theGraphicsDriver.End()
|
||||||
|
|
||||||
|
// Release the commands explicitly (#1803).
|
||||||
|
// Apparently, the part of a slice between len and cap-1 still holds references.
|
||||||
|
// Then, resetting the length by [:0] doesn't release the references.
|
||||||
|
for i := range q.commands {
|
||||||
|
q.commands[i] = nil
|
||||||
|
}
|
||||||
q.commands = q.commands[:0]
|
q.commands = q.commands[:0]
|
||||||
q.nvertices = 0
|
q.nvertices = 0
|
||||||
q.nindices = 0
|
q.nindices = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user