There's memory retention (leak) in the GridTableStyleCollection class.

This leak only becomes apparent if one creates table styles dynamically.
Every time the GridTableStyleCollection.Clear() method gets called it
simply doesn¢t clean up the necessary objects and delegates.

It¢s not a very serious leak because not many people create table styles
dynamically.

More can be read at http://blog.vandenhof.org/archive/2004/10/12/150.aspx

A program that can reproduce this problem is available for download at
http://vandenhof.org/downloads/datagridleak.zip

Just run a profiler and have a look at the continued growth of
EventHandlerList, PropertyStore, DataGridTextBox objects.

The only way to get around this leak is to dispose of the datagrid
everytime you switch (newly created) table style objects.

I stress, if you use a fixed amount of table style objects this leak won¢t
pose a problem.

Regards,

Marcel van den Hof