mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
bpo-40882: Fix a memory leak in SharedMemory on Windows (GH-20684)
In multiprocessing.shared_memory.SharedMemory(), the temporary view returned by MapViewOfFile() should be unmapped when it is no longer needed.
This commit is contained in:
parent
8749121b07
commit
85c128e34d
4 changed files with 58 additions and 2 deletions
|
@ -173,7 +173,10 @@ class SharedMemory:
|
|||
)
|
||||
finally:
|
||||
_winapi.CloseHandle(h_map)
|
||||
size = _winapi.VirtualQuerySize(p_buf)
|
||||
try:
|
||||
size = _winapi.VirtualQuerySize(p_buf)
|
||||
finally:
|
||||
_winapi.UnmapViewOfFile(p_buf)
|
||||
self._mmap = mmap.mmap(-1, size, tagname=name)
|
||||
|
||||
self._size = size
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue