C # Declining application performance due to garbage collection?

My application performance is deteriorating as it continues to run throughout the day.

I suspect this is a garbage collector, how can I check this? Is there a way to find out which object / function causes garbage collection overhead?

Is there a way to manually perform garbage collection programmatically to clear memory from leaks?

Thank,

edit At one end of the application, it receives a callback from an unmanaged api to receive data, processes it, and then sends messages from the socket on the second end. From the second end, it returns data about sent messages. The application opens 5-6 sockets for sending and receiving data from the second end. It constantly registers a large amount of data in the Windows file system in a separate stream.

My measurements include timestamping (queryperformance counter) immediately before sending the data and timestampinga again when I receive the subsequent from another process back to the socket. I noticed that of the few sockets that I open, performance degradation occurs on only one socket connection.

Processing between timestamping and dispatch. Receiving data through a socket involves iterating through 2 arraylist, which has no more than 5-6 objects and a couple of callbacks.

The memory usage from the Task MAnager window does not increase significantly. From 96MB to 100MB in 6-7 hours.

The following are some observations of perfmon running.

“survivors after finalization” and “Gen 0 advanced completion memory” gradually increase over time

"Gen 0 Collections" are being assembled from 1819 at the beginning to 6,000 in 4 hours. “Gen 1 collections” represent 10% -12% of the Gen 0 collection and “Gen 2 collection” is 1% or less. Gen 0's cumulative collections are cumulative, probably not a problem.

GC-pens "rose from 850 to 4000.

+3
3

, , GC : , .

Edit

GC , , , . , , , , , .

, .

+4

GC.Collect(), , . , , ANTS, .

ANTS

+4

, . Windows ( ), . , , GDI, , - .

, - System.Drawing Dispose() , . , , , , . , , , , GC .

, : , , . , .

+2

Source: https://habr.com/ru/post/1771590/


All Articles