Using byte Array in a DataColumn Leaks Memory? RRS feed

  • Question

  • We are using many DataTables that have byte arrays as DataColumns within a DataSet.

    When calling clear on the DataSet or DataTable it is clearing the rows in the table(s).
    Does this also clear out the byte array fields as well or does this have do be done manually by setting each byte array field to null for each row?

    Note we have some tables that contain DataColumns of System.Double[] (arrays) type as well.
    Will these cause a memory leak if only using DataSet.Clear?

    Friday, September 10, 2010 4:58 PM


  • I don't see why it should cause any memory leaks. The array fields containing data are stored in the DataRowCollection. Once those DataRows are gone from the collection, so is the data they contained, including the info stored in the arrays.

    Are you experiencing problems or are you just asking about whether it will be a problem? I'm no expert on memory usage or leaks, but I don't think this should be a problem.

    ~~Bonnie Berent [C# MVP]
    Saturday, September 11, 2010 4:42 PM