Silly question about the size of a shared memory [using the MBS plugin]

Hello,

I’m playing with the shared memory function of the MBS plugin and I’m considering how to calculate how much room I’ll need.

This is about this function: FileMappingMBS.CreateSharedMemory(name as string, Size as Int64) as boolean
Which has this line in the documentation:
The Size should be a multiple of the page size (4096).

I can understand it two ways:
• This is just the declared size that must be a multiple of 4096; in that case, 8192 is the available size.
• Any byte takes 4096 bytes of RAM (e.g. for storage or reference purpose or headers); in that case, 8192 means I can use two bytes.

I see the latter would probably be silly, but I can’t think it’s impossible. Which one is correct?

Just as sqlite it uses “pages” that contains ypur data.

4096 means you can put 4096 bytes in it.

If you can 4190 bytes for example you should be requesting (4096 *2 or 8192 bytes)

1 Like

Just request the size you need. And round up to page size.

2 Likes

Thank you. I’ll continue playing :slightly_smiling_face: