[issue39655] Shared_Memory attaching to incorrect Address in Windows

Orwell report at bugs.python.org
Sun Feb 16 14:13:46 EST 2020


New submission from Orwell <sticky.queue at gmail.com>:

Shared Memory is attaching to incorrect memory location ,
ex : retried the documentation example.

>>> import numpy as np
>>> a = np.array([1, 1, 2, 3, 5, 8])
>>> from multiprocessing import shared_memory
>>> shm = shared_memory.SharedMemory(create=True, size=a.nbytes)
>>> b = np.ndarray(a.shape, dtype=a.dtype, buffer=shm.buf)
>>> b[:] = a[:]
>>> b
array([1, 1, 2, 3, 5, 8])
>>> type(b)
<class 'numpy.ndarray'>
>>> type(a)
<class 'numpy.ndarray'>
>>> shm.name
'wnsm_62040dca'
>>> shm.buf
<memory at 0x000002AD10118DC0>

# In either the same shell or a new Python shell on the same machine

>>> import numpy as np
>>> from multiprocessing import shared_memory
>>> existing_shm = shared_memory.SharedMemory(name='wnsm_62040dca')
>>> c = np.ndarray((6,), dtype=np.int64, buffer=existing_shm.buf)
>>> c
array([ 4294967297, 12884901890, 34359738373,           0,           0,
                 0], dtype=int64)
>>> c[-1]
0
>>> existing_shm.buf
<memory at 0x000001CF627E8DC0>

----------
components: Windows
messages: 362093
nosy: OH, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Shared_Memory attaching to incorrect Address in Windows
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39655>
_______________________________________


More information about the Python-bugs-list mailing list