gc_max_allocs should include blocked & migrating

This commit is contained in:
Michael Schurter
2017-05-12 16:03:22 -07:00
parent e3c1d35111
commit fb72f20bb1

View File

@@ -724,7 +724,13 @@ func (c *Client) getAllocRunners() map[string]*AllocRunner {
// fulfill the AllocCounter interface for the GC.
func (c *Client) NumAllocs() int {
c.allocLock.RLock()
c.blockedAllocsLock.Lock()
c.migratingAllocsLock.Lock()
n := len(c.allocs)
n += len(c.blockedAllocations)
n += len(c.migratingAllocs)
c.migratingAllocsLock.Unlock()
c.blockedAllocsLock.Unlock()
c.allocLock.RUnlock()
return n
}