Main Site Documentation

Some kind of "shared memory" on USBizi?


#1

Hi,
Is there a way to share a object, struct or array between RLP and managed?

For example:
Array one, Managed -> RLP, readonly on rlp
Array two, RLP -> Managed, readonly on managed

Or, if not. Which way has the smallest overhead?

Chris


#2

You can’t share memory.


#3

using the generalarray argument in rlp function calls is the fastest way to exchange a datablock


#4

You could use a CustomHeap allocated buffer (LargeBuffer). It’s location is not affected by the garbage collector. And pass it’s Bytes property to the unmanaged side by invoking an unmanaged function. This way you will get the memory location of the buffer in the unmanaged side (read/write) and you will be able to read/write it in the managed side also.

Please correct me if I’m wrong but this is how I understood it.


#5

Yes but there no custom heap on little devices


#6

Oh, I didn’t noticed it was about USBizi.


#7

I want to share a object, just like zerov83 (Chris) wanted, but on a Cobra-board.
With a Cobra-board i can use a custum heap, right? I can allocate it on one side and send the memory location to the other side to use it!?
Can I not use just malloc instead of malloc_customheap?

Martin


#8

Yes you can use custom heap. I think the best way is to use “LargeBuffer” object. I never tested this myself.


#9

I made it with the normal malloc function, because I dont need such a large buffer, and it worked fine. But when I read from one side and the other Side writes at the same time, then there is a problem. I think that both sides cant use the same Memory at the same time.
Has anybody an Idea how I can solve this problem?