.comment-link {margin-left:.6em;}


.. Hello Earthling .. \o/ :)

nasty UltraGridRow memory leak
Friday, March 13, 2015

Found a really nasty memory leak in UltraGridRow. There is this code in our application that has to export Infra's Ultra Grid data to a csv file, its fairly simple, for each row the developer goes through all its non-hidden colums, gets the value from the cell, and appends it into the StringBuilder, which in the end is dumped into a file. During testing the test guy reported that he was exporting data from the grid that has 3000 columns, and around 1000 rows, ultra grid shows the data just fine, no problems there, but when we enumerate all its rows and get all its values, the application goes out of memory and crashes. Upon a lot of debugging of carefully using stringbuilers, strings, streamwriters, filestream, I found out that it was just the "gridrow.Cells[z].Value.ToString()" that was the cause of memory leak, and no kind of GC Collects were able to solve this problem.
The resolution of it was that instead of getting values directly from the cells, I took a reference of the grid's DataSource property as it was a DataTable, and through this dt I got the strings that I wanted to write to the file. Problem was solved, I tested with 10000 rows with 3000 columns, no out of memory problems.

Wednesday, March 11, 2015

Having programmed for a long long time in Visual Studio I just found out today that there is no RELEASE conditional compilation symbol defined -.-
So either you always utilise the #else of DEBUG like:

  // release code here

or you goto the project properties, select Release in Configuration

and type your own RELEASE and save. Now you can do:

  // release code here


MSDN Blogs
Joel Pobar
Don Syme

Muhammad Ali
Lahore Food Blog

Tech Blog



June 2004   July 2004   August 2004   September 2004   October 2004   November 2004   December 2004   February 2005   April 2005   June 2005   July 2005   September 2005   October 2005   November 2005   June 2007   December 2007   January 2008   March 2008   April 2008   June 2008   October 2008   February 2009   May 2009   June 2009   July 2009   August 2009   March 2011   June 2011   July 2011   September 2011   October 2011   November 2011   December 2012   May 2013   October 2013   May 2014   March 2015   July 2015   August 2015   December 2015   March 2016   July 2016   October 2016   November 2016  

This page is powered by Blogger. Isn't yours?