Drop reference on shared anon mappable

We call NewSharedAnonMappable simply to use it for Mappable/MappingIdentity for
shared anon mmap. From MMapOpts.MappingIdentity: "If MMapOpts is used to
successfully create a memory mapping, a reference is taken on MappingIdentity."

mm.createVMALocked (below) takes this additional reference, so we don't need
the reference returned by NewSharedAnonMappable. Holding it leaks the mappable.

PiperOrigin-RevId: 241038108
Change-Id: I78ee3af78e0cc7aac4063b274b30d0e41eb5677d
This commit is contained in:
Michael Pratt 2019-03-29 13:16:49 -07:00 committed by Shentubot
parent 69afd0438e
commit d11ef20a93
1 changed files with 1 additions and 0 deletions

View File

@ -101,6 +101,7 @@ func (mm *MemoryManager) MMap(ctx context.Context, opts memmap.MMapOpts) (userme
if err != nil {
return 0, err
}
defer m.DecRef()
opts.MappingIdentity = m
opts.Mappable = m
}