We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

forceGcCollect and Load factor too high

Thread ID:

Created:

Updated:

Platform:

Replies:

32767 Aug 8,2005 09:42 AM UTC Aug 9,2005 04:51 PM UTC WinForms 5
loading
Tags: GridControl
peterainbow
Asked On August 8, 2005 09:42 AM UTC

Hi, We''re using a grid in virtual mode and everynow and then we get the ''Hashtable insert failed. Load factor too high.'' Looking in the syncfusion source for GridVolatileData I found referneces to this and a mysterious member forceGcCollect, which it says should be changed if this happens. However we do not have access to this member. What should we do about this problem as it''s causing our reports to fail every now and then? cheers pete

peterainbow
Replied On August 8, 2005 03:58 PM UTC

bump..

Administrator [Syncfusion]
Replied On August 8, 2005 06:25 PM UTC

Pete, you can use reflection to modify this property. Example: void AdjustForceGcCollect(GridModel gridModel, int newValue) { GridVolatileData volatileData = gridModel.VolatileData as GridVolatileData; if (volatileData != null) { System.Reflection.FieldInfo fi = typeof(GridVolatileData).GetField("forceGcCollect", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); if (fi != null) { fi.SetValue(volatileData, newValue); } } } public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); AdjustForceGcCollect(this.gridControl1.Model, 2000); ... } We can also add code in the exception handler to automatically reduce the value to the current size of elements in the hashtable. But I am surprised this happens. The exception is only there because we thought there is a chance this happens if the garbage collection is not called early enough and the hashtable fills up to much. Do you hold onto style objects in your application? Thanks, Stefan

peterainbow
Replied On August 9, 2005 09:44 AM UTC

no we don''t hold onto style objects, at least not intentionally :-) do you think this could happen in a low memory situation? What we''re doing in our code is exporting a complete grid and it''s a very large grid ~200,000 rows in virtual mode. What i''m going to try and do is not use the grid indexer to get the data but go direct to our own querycell callback handler, which will be faster and won''t go through the style caching code. i''m testing something like ... GridStyleInfo style = new GridStyleInfo(new GridStyleInfoIdentity(gridControl1.Model.VolatileData, rowIndex, colIndex)); GridQueryCellInfoEventArgs args = new GridQueryCellInfoEventArgs( rowIndex , colIndex , style ); style.BeginInit(); this.GridQueryCellInfo( this , args ); style.EndInit(); return style.Text;

Administrator [Syncfusion]
Replied On August 9, 2005 11:51 AM UTC

Hi Pete, that should work. Since your code is creating the style you can also call Dispose() on the style object after you do not need it anymore. I don''t think you are holding onto objects. I guess it''s just the repeated call directly to the indexer within one proceedure that is causing the GC to be a bit behind. I think bypassing the indexer will speed up things for you since there is no need to cache these values. Stefan >no we don''t hold onto style objects, at least not intentionally :-) > >do you think this could happen in a low memory situation? > >What we''re doing in our code is exporting a complete grid and it''s a very large grid ~200,000 rows in virtual mode. > >What i''m going to try and do is not use the grid indexer to get the data but go direct to our own querycell callback handler, which will be faster and won''t go through the style caching code. > >i''m testing something like ... > >GridStyleInfo style = new GridStyleInfo(new GridStyleInfoIdentity(gridControl1.Model.VolatileData, rowIndex, colIndex)); >GridQueryCellInfoEventArgs args = new GridQueryCellInfoEventArgs( rowIndex , colIndex , style ); >style.BeginInit(); >this.GridQueryCellInfo( this , args ); >style.EndInit(); >return style.Text; >

peterainbow
Replied On August 9, 2005 04:51 PM UTC

ooh hadn''t noticed it was disposable, i''ll stick a using stement in then :-)

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;