from multiprocessing import shared_memory
memory = shared_memory.SharedMemory(None, create=True, size=81 + 4)
print(f"PY: shared_memory_name: {memory.name}")
input() # this hangs the script
This is my node index.ts:
import shm from "shm-typed-array"
const buf = shm.get(process.argv[2])
log(buf.length)
process.exit(1)
I run this b like this:
python test.py
(copy the key i.e: psm_d464f8bd)
npx tsc && node dist/index.js psm_d464f8bd
This is my output from node:
NODE: shared_memory_name: psm_d464f8bd
NODE: 0
So buf.length is 0, while it should be 85. shm.get doesn't return null or undefined so it registers that there is some shared memory assigned there, but it refuses to read it... Why?
I tried spawning the node process from python with Popen, because i read something about access only happening when its a child process but same issue. Im on arch btw
This is my python script.py:
This is my node index.ts:
I run this b like this:
(copy the key i.e: psm_d464f8bd)
This is my output from node:
So buf.length is 0, while it should be 85.
shm.get
doesn't return null or undefined so it registers that there is some shared memory assigned there, but it refuses to read it... Why?I tried spawning the node process from python with
Popen
, because i read something about access only happening when its a child process but same issue. Im on arch btw