DataTable.DefaultView.Sort throwing out of memory exception
-
Hello, my utility works ok on small data samples, but it's throwing an "Out of memory" exception on me whenever I try to apply it on a bigger data sample (a couple of hundred MBs). The exception is thrown during the sort. Is this a physical limitation of the DataTable or am I missing something? This is the dump of the exception description:
System.OutOfMemoryException was unhandled
Message="Exception of type 'System.OutOfMemoryException' was thrown."
Source="System.Data"
StackTrace:
at System.Data.RBTree`1.TreePage..ctor(Int32 size)
at System.Data.RBTree`1.AllocPage(Int32 size)
at System.Data.RBTree`1.GetNewNode(K key)
at System.Data.RBTree`1.Insert(K item)
at System.Data.Index.InitRecords(IFilter filter)
at System.Data.Index..ctor(DataTable table, Int32[] ndexDesc, IndexField[] indexFields, DataViewRowState recordStates, IFilter rowFilter)
at System.Data.DataTable.GetIndex(IndexField[] indexDesc, DataViewRowState recordStates, IFilter rowFilter)
at System.Data.DataView.UpdateIndex(Boolean force, Boolean fireEvent)
at System.Data.DataView.UpdateIndex(Boolean force)
at System.Data.DataView.SetIndex2(String newSort, DataViewRowState newRowStates, DataExpression newRowFilter, Boolean fireEvent)
at System.Data.DataTable.get_DefaultView()
at TickConvertor.Program.Main(String[] args)Thanks much for any input! Michal
-
Hello, my utility works ok on small data samples, but it's throwing an "Out of memory" exception on me whenever I try to apply it on a bigger data sample (a couple of hundred MBs). The exception is thrown during the sort. Is this a physical limitation of the DataTable or am I missing something? This is the dump of the exception description:
System.OutOfMemoryException was unhandled
Message="Exception of type 'System.OutOfMemoryException' was thrown."
Source="System.Data"
StackTrace:
at System.Data.RBTree`1.TreePage..ctor(Int32 size)
at System.Data.RBTree`1.AllocPage(Int32 size)
at System.Data.RBTree`1.GetNewNode(K key)
at System.Data.RBTree`1.Insert(K item)
at System.Data.Index.InitRecords(IFilter filter)
at System.Data.Index..ctor(DataTable table, Int32[] ndexDesc, IndexField[] indexFields, DataViewRowState recordStates, IFilter rowFilter)
at System.Data.DataTable.GetIndex(IndexField[] indexDesc, DataViewRowState recordStates, IFilter rowFilter)
at System.Data.DataView.UpdateIndex(Boolean force, Boolean fireEvent)
at System.Data.DataView.UpdateIndex(Boolean force)
at System.Data.DataView.SetIndex2(String newSort, DataViewRowState newRowStates, DataExpression newRowFilter, Boolean fireEvent)
at System.Data.DataTable.get_DefaultView()
at TickConvertor.Program.Main(String[] args)Thanks much for any input! Michal
Seems like using DataTable.Select() instead of the DataTable.DefaultView.Sort might be the solution. Michal
-
Seems like using DataTable.Select() instead of the DataTable.DefaultView.Sort might be the solution. Michal
DataTable.Select() is throwing the same exception. Any ideas? Thanks, Michal