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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

InvalidOperationException: ''''Hashtable insert failed. Load factor too high.''''

Thread ID:

Created:

Updated:

Platform:

Replies:

56487 Feb 15,2007 05:10 PM UTC Feb 16,2007 10:48 PM UTC WinForms 3
loading
Tags: GridControl
CarlosQ
Asked On February 15, 2007 05:10 PM UTC

Hi,

My team is using .NET 1.1 SP1 and the Syncfusion.Grid 1.5.1.1 (I know, quite old).

From time to time our users get the exception:

InvalidOperationException: "Hashtable insert failed. Load factor too high."

in a line of code like:

GridControl(row, col).CellType

I have searched the web and it happens that:

1) A similar problem was already reported:

http://www.syncfusion.com/support/forums/message.aspx?MessageID=32767

2) It seems to be actually a problem of the .NET Framework that should be fixed in .NET 1.1 SP1:

FIX: "InvalidOperationException, Load Factor Too High" When You Use a Hashtable Collection
http://support.microsoft.com/kb/831730/

but it seems that it still happens even in .NET 2.0:

http://blogs.msdn.com/toddca/archive/2007/01/26/hashtable-insert-failed-load-factor-too-high.aspx

My questions are:

1) Which is the official answer from Syncfusion to avoid this problem?

2) Is there a higher version of the grid control that solves the problem?

Thanks in advance,

Carlos

Administrator [Syncfusion]
Replied On February 15, 2007 09:58 PM UTC

Hi CarlosQ,

1) Which is the official answer from Syncfusion to avoid this problem?
>>>>>
When you use the debug builds for EG, you will get a trace message that indicates how many items are in the volatile data cache.

Here is the code for SetItem

public void SetItem(GridCellPos cell, GridStyleInfo style)
{
try
{
if (data.Count >= forceGcCollect)
GC.Collect();
#if DEB
if (data.Count > maxDataCount)
{
Console.WriteLine("VolatileData HashTable: " + data.Count.ToString());
maxDataCount = data.Count + data.Count/10; // let's just show a Trace statement for larger increases ...
}
#endif
data[cell] = new WeakReference(style);
}
catch (InvalidOperationException ex)
{
// should be InvalidOperation_HashInsertFailed=Hashtable insert failed. Load factor too high.
TraceUtil.TraceExceptionCatched(ex);
Trace.WriteLine("Detected too many items in volatile date hashtable. You should set GridVolatileData.forceGcCollect to a value below " + data.Count.ToString());
TraceUtil.TraceCurrentMethodInfo("Hashtable count: ", data.Count);
GC.Collect();
TraceUtil.TraceCurrentMethodInfo("Hashtable count after GC.Collect: ", data.Count);
data[cell] = new WeakReference(style);
}
}

The exception itsself is handled by an exception handler and resolved when it happens. Basically what I need to do is force a call to GC.Collect.

If you have source code than you could change the value for forceGCCollect to be less than what is written out.

The error can happen in rare cases when more items are cached than the Hashtable can hold. This is when you do a extensive operation and GC is not called for a while or when you keep references to the style objects and therefore the GC can not release the objects.

2) Is there a higher version of the grid control that solves the problem?
>>>>>>
This issue has been fixed in our latest version V4.4. Please refer the link below for the download details of the latest version.
http://www.syncfusion.com/downloads/latestversion/default.aspx

FYI, we have added many new features and samples to our latest version. Performance of gridgroupingcontrol has been increased.

Let me know if this helps.

Best regards,
Haneef

CarlosQ
Replied On February 16, 2007 01:07 PM UTC

Hi,

> The exception itself is handled by an
> exception handler and resolved when it
> happens.

I don't think that the exception handler resolves it, since your code basically does this:

- If a condition about forceGCCollect is true,
call GC.Collect
- Call f1
- If InvalidOperationException is thrown then:
- Call GC.Collect
- Call f1

Since we are getting an unhandled InvalidOperationException in our code it means that your exception handler caused it in the second call to f1 after forcing the GC.Collect. Am I right? If so, I don't see how altering forceGCCollect to make the comparison true and force the first GC.Collect would make a different final result. Can you clarify?

> The error can happen in rare cases when more
> items are cached than the Hashtable can hold.

If the problem is the capacity of a hashtable, how is that related to GC?

> This is when you do a extensive operation
> and GC is not called for a while

Yes, our develoepers are using an extensive operation, a grid exportation, iterating rows and cols, but your code forces a GC, so?

> or when you keep references to the style
> objects and therefore the GC can not
> release the objects.

I think our developers are not holding references to GridStyleInfo instances, but I see that this class implements IDisposable and they are not calling Dispose when done. Should they call Dispose()?

> This issue has been fixed in our latest
> version V4.4

Is it a problem in the developer's code that we must fix or in your grid code? How did you fix it in V4.4?

Thanks in advance again,

Carlos

Administrator [Syncfusion]
Replied On February 16, 2007 10:48 PM UTC

Hi CarlosQ,

We will update you on Monday regarding this issue. We sincerely apologize for this time delay.

Thanks for using Syncfusion Support.

Best regards,
Haneef

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

;