diff --git a/.travis.yml b/.travis.yml index c447fde..eafe14d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,5 +19,5 @@ - golint . - go test -cover -race -count=1 -timeout=30s -run . - go test -covermode=count -coverprofile=coverage.out -timeout=90s -run . - - '[ ! -z "$COVERALLS_TOKEN" ] && $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN' + - if [ "$TRAVIS_BRANCH" = "master" ]; then $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN; fi - cd bench; go test -run=Bench.* -bench=. -benchmem; cd ..diff --git a/CHANGELOG.md b/CHANGELOG.md index ccbf9cc..a1d5baf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.10.0 (December 2021) + +#62 : @nikhilk1701 found a memory leak where removed items are not directly eligible for garbage collection. There are no API changes. + # 2.9.0 (October 2021) #55,#56,#57 : @chenyahui was on fire and greatly improved the peformance of the library. He also got rid of the blocking call to expirationNotification, making the code run twice as fast in the benchmarks! diff --git a/priority_queue.go b/priority_queue.go index eddd76b..5d40548 100644 --- a/priority_queue.go +++ b/priority_queue.go @@ -78,6 +78,8 @@ n := len(old) item := old[n-1] item.queueIndex = -1 + // de-reference the element to be popped for Garbage Collector to de-allocate the memory + old[n-1] = nil pq.items = old[0 : n-1] return item }