C# .NET Linq Memory Cleanup or Leak? -


I have a large 2GB file that has 1.5 million entries for the process. I am running a console application which manipulates some strings then uploads every entry to the database

  1. I created a LINQ object and object to a new LinqObject ()

  2. for each list (loop) when the object is complete

  3. When the list reaches 100 objects, I submit it to everyone on the entire list, clear the list, I repeat again.

The use of my memory continues to grow as the program runs. Should I do something to keep memory usage? I tried GC.collect. I think I want to use the settlement ..

Thank you for looking at the past.

When it is working, then it is normal for the memory to be used for programmable resources To save you, you should not try to force the garbage collector to reduce memory usage, instead it will ruin the resources.

Contrary to someone's first reaction, high memory usage is not a display problem unless no free memory is left. There is not a slight increase in performance due to many unused memory. If you try to reduce memory usage only to keep it down, then you are wasting time of CPU for cleaning time, which is not necessary.

If you are running out of free storage or if any other application is required, the garbage collector will do the proper cleaning, in almost every situation, the garbage collector will have more information about the current memory status, which writes the code. The time you possibly can hope for.

If you are using objects that implement the idisposable interface, then you should call the disposable method to free unmanaged resources, but all other items are controlled by the garbage collector. is. Managed objects generally do not leak memory.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -