Obiwan Jacobi
5/10/2007 9:57:00 AM
On May 9, 11:29 am, Christian Fröschlin <froesch...@mvtec.com> wrote:
> > The question is: should I copy my managed MidiHeader into an unmanaged
> > memory block to build the MIDIHDR structure or should I pin my managed
> > MidiHeader and pass its address directly?
>
> I would prefer using an unmanaged memory block for this, because
> it makes you independent of the way the GC handles pinning.
That would be my hunch too, but I'm not completely up-to-date on how
the GC handles pinning. But the thought of a fixed memory block the GC
has to work around suggests that its efficiency can be severly
impacted when multiple pinned objects exist (possible spread over the
entire memory space)... I don't know, seems better to take the
overhead of copying data.
My current implementation uses an unmanaged memory block (allocate
through the Marshal class) and copies in the MIDIHDR data. I think
I'll stick to that...
Thanx,
--Marc