Understanding the Performance Implications of the Event Model

There's a similar scenario that is specific to Managed Direct3D. You've already learned that each resource that is created hooks the device events for at least disposing, and in many cases, device lost and device reset as well. Each of these event hooks can do a few things that can be disastrous to your performance if you aren't aware of them.

First, there is the actual memory allocation. Every time you create a vertex buffer, for example, aside from the normal vertex buffer allocations, just to cover the event handlers, there are three extra allocations of delegates. Couple this with the fact that these event handlers act as hard links to the object itself, and you can see that these ...

Get Managed DirectX® 9 Kick Start: Graphics and Game Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.