[zeromq-dev] P/Invoke-based CLR access to zeroMQ

Martin Sustrik sustrik at fastmq.com
Sun Feb 22 12:52:35 CET 2009

Martin Sustrik wrote:
>> I would rather think of a way to pin the CLI-supplied buffer down, send 
>> it to 0MQ and ask it (via ffn) to unpin the buffer once the data are 
>> physically sent to the network. Is that kind of thing possible?
> What about GCHandle?
> Have a look at section "Object Lifetime and Pinning" here:
> http://msdn.microsoft.com/en-us/magazine/cc163910.aspx

One more though: If we are going this way, I would expect that pinning 
is not for free. At least it would have an unwelcome effect of getting 
in conflict with gc algorithms. Thus I would suggest using pinning only 
for messages larger than X bytes and pass smaller messages on by copy.

This system of zero-copy+pin for large messages vs. copy+no-pin for 
small messages is rather standard at low layers of high-perf networking 
software. Why not use the same thing in the upmost layer?


More information about the zeromq-dev mailing list