Is there a way to control memory usage of C # DataTable

I am writing a tool to copy data to SQL Server using C # SqlBulkCopy. For reliability reasons, I load each batch of data into the DataTable (so that later I can retry in the same batch if the insert fails) and users can specify the batch size. Now the problem is that the user sets the batch size to a very large value, the memory consumption of the DataTable will be huge and even throw an OutOfMemoryException.

One solution I can think of is to sum the data size as I am caching the data in the DataTable and control the size there. Are there better approaches?

Thank.

+3
c # memory sqlbulkcopy out-of-memory datatable


source to share


No one has answered this question yet

Check out similar questions:

6155
What is the difference between string and string in C #?
3575
How to list a transfer?
3044
Making a memory leak with Java
2964
How to cast int to enum?
2397
What are the correct version numbers for C #?
2391
What's the best way to iterate over a dictionary?
1207
Strange memory issue when loading image into Bitmap object
987
LINQ Query on DataTable
772
How can I find out the memory usage of my application in Android?
672
How do you measure the actual memory usage of an application or process?



All Articles
Loading...
X
Show
Funny
Dev
Pics