[Gtk-sharp-list] [PATCH] Extra allocations in Gtk# structs
Paolo Molaro
lupus@ximian.com
Mon, 12 Jan 2004 16:42:41 +0100
On 01/11/04 Ben Maurer wrote:
> (<mytype>) Marshal.PtrToStructure (raw, self.GetType ());
>
> However, this is slow, because the Marshal method ends up allocating a
> boxed value type. So, I changed the generator to emit:
>
> return *(<mytype>*) raw;
>
> This is much faster, as it is just an indirection + copy. I tested
> monodoc and MD after the change, they work fine.
How do you guarantee the structure won't need marshaling?
In that case your new code is incorrect.
lupus
--
-----------------------------------------------------------------
lupus@debian.org debian/rules
lupus@ximian.com Monkeys do it better