Check for empty applicationAddrRange in MM.DecUsers.

PiperOrigin-RevId: 202043776
Change-Id: I4373abbcf735dc1cf4bebbbbb0c7124df36e9e78
This commit is contained in:
Jamie Liu 2018-06-25 16:49:47 -07:00 committed by Shentubot
parent 4ac79312b0
commit 16882484f9
1 changed files with 5 additions and 1 deletions

View File

@ -214,5 +214,9 @@ func (mm *MemoryManager) DecUsers(ctx context.Context) {
mm.mappingMu.Lock()
defer mm.mappingMu.Unlock()
mm.unmapLocked(ctx, mm.applicationAddrRange())
// If mm is being dropped before mm.SetMmapLayout was called,
// mm.applicationAddrRange() will be empty.
if ar := mm.applicationAddrRange(); ar.Length() != 0 {
mm.unmapLocked(ctx, ar)
}
}