ukrbublik / shm-typed-array

IPC shared memory for NodeJs. Use as Buffer or TypedArray.
MIT License
71 stars 9 forks source link

Question about memory layout #21

Open drghirlanda opened 8 months ago

drghirlanda commented 8 months ago

Hi, and thanks for this module! I am having it inter-operate with a C program using the POSIX shm_* functions. I have noticed that, from the point of view of C, it seems that the module considers the data to start two elements past the initial shared memory address. It also seems that it uses the first element to store the number of elements. Is this correct? Is there a use for the second element of shared memory?

If I just take into account this 2-element offset, everything seems to work fine, I can create shared memory in C or JS (under node), and read from and write to it from both C and JS.

Thanks!