Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix underlying slice by providing a new one
When we read off the queue.read slice, it essentially pops the first available element by doing this: case eh.ch <- eh.queue.read[0]: eh.queue.read[0] = Event{} eh.queue.read = eh.queue.read[1:] So the entry where the event used to exist has been overwritten with a fresh instance of Event which will avoid a memory leak. However the issue is that the underlying slice keeps growing. During a long running test the slice could grow to an unnecessarily length. To avoid this issue, when queue.read is empty and is swapped with queue.write, just before swapping them around the existing queue.read is overwritten with a new slice, freeing up the old potentially long slice. This should help avoid memory leaks.
- Loading branch information