OutOfMemoryException when using WriteRecords with .NET Core 3.1 #1465
Unanswered
adrianwright109
asked this question in
Q&A
Replies: 1 comment
-
Maybe there was a change in default memory size between 2.1 and 3.1 or something. You're passing in items, then writing them all to memory. You're essentially duplicating all the data in memory. Is there the possibility that more than one of these could be running at a time? Like if this is a call on a website or something. You could potentially have issues there. Anything you can do to keep the memory down would be a good idea. Batching them 100 or 1,000 at a time would definitely help. If it's a lot faster to large amounts of data at once, you'll have to balance that speed with how much memory you want to consume. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
We have been using CsvHelper version
12.1.2
in our .NET Core 2.1 package using the following code to generate a CSV file so that the result can be saved into Azure Blob Storage:N.B. Data being written to CSV file is large > 500,000 records.
We didn't see any issues with this code running under .NET Core 2.1, but since upgrading the project to .NET Core 3.1 we have started to see
OutOfMemoryException
s when callingcsvWriter.WriteRecords(dataItems);
Would it help if we were to:
Upgrade the CsvHelper package to the latest version (
15.0.0
) ?Batch the records so that it doesn't write 500,000+ records at a time ?
Beta Was this translation helpful? Give feedback.
All reactions