Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我的代码中有一些 Trace.Write 行但没有侦听器,那么进行这些调用会导致过多的内存使用/内存泄漏吗?
我假设 trace.write 只是进行事件调用,实际上并未进行任何数据存储,因此基于此假设答案是否定的,它不会消耗大量内存
没有内存泄漏,但是如果开启跟踪,即使没有监听器,处理器和内存都会有一些开销。如果您什么都不做,我会关闭跟踪,这可以在配置中轻松完成。