简体   繁体   English

C#/。NET垃圾密集型系统调用

[英]C#/.NET Garbage intensive system calls

What are the .net library calls and system calls that cause the most garbage? .net库调用和引起最大垃圾的系统调用是什么? I read somewhere DayLightTime causes a lot of garbage and result in garbage collector activity. 我在某处阅读DayLightTime导致大量垃圾并导致垃圾收集器活动。

I need to find a list of such calls. 我需要查找此类呼叫的列表。

Why? 为什么?

Strive to make your code as clean (in style, not garbage) as possible. 力争使您的代码尽可能整洁(样式,而不是垃圾)。 If it is too slow, profile and find the problem. 如果速度太慢,请分析并找到问题。 Making a list of methods not to call to try and reduce garbage in the future seems like a losing idea. 列出将来不要尝试减少垃圾的方法列表似乎是一个失败的想法。

If you mean 'which calls allocate the most memory that they then free', then it's completely unanswerable, as the amount of memory they use is very likely to depend on the size of the job you give them. 如果您的意思是“哪个调用分配了他们随后释放的最大内存”,那将是完全无法回答的,因为它们使用的内存量很可能取决于您分配给他们的工作量。

The .NET framework source is available for download if you want to see how a particular call works. 如果要查看特定调用的工作方式,可以下载.NET框架源。 http://referencesource.microsoft.com/netframework.aspx http://referencesource.microsoft.com/netframework.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM