Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. DataTable.DefaultView.Sort throwing out of memory exception

DataTable.DefaultView.Sort throwing out of memory exception

Scheduled Pinned Locked Moved C#
databasetoolsperformancequestion
3 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    michal kreslik
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • M michal kreslik

      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

      M Offline
      M Offline
      michal kreslik
      wrote on last edited by
      #2

      Seems like using DataTable.Select() instead of the DataTable.DefaultView.Sort might be the solution. Michal

      M 1 Reply Last reply
      0
      • M michal kreslik

        Seems like using DataTable.Select() instead of the DataTable.DefaultView.Sort might be the solution. Michal

        M Offline
        M Offline
        michal kreslik
        wrote on last edited by
        #3

        DataTable.Select() is throwing the same exception. Any ideas? Thanks, Michal

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups