Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
"OutOfMemory Exception" throws when binding to UltraGrid


I am using version 14.1 and get "OutOfMemory" Exception when try to bind data into UltraGrid data source.
My dataTable inside dataSet has more than 400k records.

ultraGrid.SetDataBinding(dataSet, tableName);

Is there any solution for this situation?


  • 469350
    Offline posted

    400,000 rows probably isn't a reasonable use case. The grid doesn't create ALL of the rows up front in the case of hierarchical data, but if you sort or filter, then it will eventually need to do so and it certainly would not be surprising if loading that many rows into memory at once exceeded the amount of RAM on the machine. Even without the grid, a DataSet with that many rows is going to use up a whole lot of memory. 

    Not to mention that no human user could possibly work with so much data in the UI, anyway. 

    Is your data flat? Is this a single table with 400k rows? Or is it a hierarchy? 
    if your data is hierarchical, you might be able to improve memory usage by limiting the hierarchy depth.  As a test, you could try something like this and see if that helps: 

    this.ultraGrid1.DisplayLayout.MaxBandDepth = 5;

    Another option would be to use the grid's LoadOnDemand functionality. If you chose to install the sample, then there's a Million Rows Sample included where the grid basically only acts as a sort've data window and loads what it needs. But it's a lot more coding and you will need to handle external sorting, filtering, summaries, etc. 

    You could also check out the WinGrid Performance Guide for some tips on how to make the grid use less memory. 

    But really... rather than jump through all those hoops, it would almost certainty be a whole lot easier to simply give the user some kind of search functionality so they can retrieve a small subset of the records they need, rather than presenting them with 400k rows at once. 

  • 530
    Offline posted

    Hello Dang,

    How many columns do you have in the DataTable? I loaded 500000 records (with 6 columns) but out of memory exception does not occur. If you run the attached sample on your end, can you reproduce the exception? By the way, 14.1 is currently out of maintenance so we will investigate your issue based on the latest version (20.2). Thank you for your understanding.