Forum

Shared memory from python

Is there any info on sending data from other apps to vvvv trough shared memory? Is the shared memory node using memory mapped files?

I checked the help patch of Reader/Writer Raw SharedMemory node but it’s not clear for me if vvvv uses memory mapped files then why it uses “names” instead of filenames to identify memory locations?

to my understanding you can use any string to identify a memory mapped file. doesn’t have to be a “filename” in the traditional sense.

I’m confused because to my understanding in python memory mapped files either correspond to an actual file on the disk or being anonymous:

https://docs.python.org/2/library/mmap.html

ok, i only knew of anonymous so far, which the Reader/Writer (Raw SharedMemory) are using. if you need a persistent file you’ll have to write your own little plugin.

seems to be just a few lines of code, see:

and here is how to write a dynamic plugin in vvvv using c#:

1 Like

Ah, I see. Thank you for the help!

There is a new feature in python 3.8 allowing you to share memory from python to vvvv right out of the box:
https://docs.python.org/3.8/library/multiprocessing.shared_memory.html

2 Likes

@sinao That’s nice! Thanks for sharing!

if you need older pythons use this ( works in python 3.7. )
vvvv_2019-04-05_00-28-05

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.