Essential Grouping Windows Forms
GDI Objects reaching limit of 10000
December 22, 2011 12:56 AM by Ragamathulla B[Syncfusion]
sean
GDI Objects reaching limit of 10000
December 8, 2011 12:48 PM
Hi,

We are setting the text in the QueryCellStyleInfo event on our gridgroupingcontrol. When we do this and start scrolling around the grid we eventually get an out of memory exception. What we can see going on is when we set the text using property GridTableCellStyleInfo.Text and scroll around on the grid the number of GDI objects keeps increasing until the 10000 limit is hit and an out of memory exception is thrown. The GDI objects never seem to be released. Is there a way to keep this from happening?

Thanks!

Ragamathulla B
[Syncfusion]
GDI Objects reaching limit of 10000
December 10, 2011 12:19 AM
Hi Sean,

Thank you for your interest in syncfusion products,

1) I Would request you to please provide your version details.
2) And also am afraid to reproduce your reported issue so please provide more details and sample regarding your issue. Thanks for aditional information.

Please let me know if you have any further concerns.

Regards,
Ragamathullah B.

sean
GDI Objects reaching limit of 10000
December 19, 2011 09:00 AM
The version is 8.3.0.21.

I now think it has more to do with setting the font size or color. I have modified one of the demo's to show what is happening. Once running just keep scrolling up and down and watch the gdi object grow on a Win7 machine. Once the 10000 limit is reached an out of memory error is thrown.

We are adding custom sections on the grid and setting the text and font size and color in QueryCellStyleInfo.



CS_c1d80700.rar
Ragamathulla B
[Syncfusion]
GDI Objects reaching limit of 10000
December 19, 2011 07:48 PM
Hi Sean,

Thanks for the update.

The QueryCellInfo is trigger every time so i would request you to please use PrepareViewStyleInfo instead of QueryCellInfo. The following code explains the same.

gridGroupingControl1.TableControl.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(TableControl_PrepareViewStyleInfo);

void TableControl_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
//code
}

Please let me know if you have any further concerns.

Regards,
Ragamathullah B.

sean
GDI Objects reaching limit of 10000
December 20, 2011 10:11 AM
Thanks!

If we run into any more issues I will consider making that change. I managed to solve this by a recommendation in a previous post on the forums.

Ended up going with adding new base styles and using those in when setting the font properties in query cell style info method. Seems to have solved the issue.

Using this during grid intialization:

gridGroupingControl.BaseStyles.Add("BoldStyle");
gridGroupingControl.BaseStyles["BoldStyle"].StyleInfo.Font.Bold = true;
gridGroupingControl.BaseStyles["BoldStyle"].StyleInfo.Font.Size = 7;

Then in querycellstyleinfo assigning the new style:

eStyle.BaseStyle = "BoldStyle";

Thanks again!
Sean

Ragamathulla B
[Syncfusion]
GDI Objects reaching limit of 10000
December 22, 2011 12:56 AM
Hi Sean,

Please let me know if you have any concern.

Regards,
Ragamathullah B.

::adCenter::