gpt4 book ai didi

.net - SmartAssembly 内存管理

转载 作者:行者123 更新时间:2023-12-01 13:09:23 26 4
gpt4 key购买 nike

刚遇到this website .功能 9 是内存管理,他们声称他们的产品“自动释放 [es] 不再需要的内存”。

这是一种营销策略,还是你认为他们有什么诡计?他们是否只是根据 .Net 运行时在任何情况下提供的内容提出 claim (或者他们是否喘不过气来调用 GC.Collect())?

对产品并不真正感兴趣,DotFuscator 对我来说就足够了——我只是对如何实现这一点非常感兴趣。

最佳答案

有趣的。

一个 review from 2007包含这个:

{smartassembly} uses several different techniques to bring down the memory usage.

We asked the developers of {smartassembly} for some of the specifics, and they told us that by default the CLR reserves a ton of memory for .NET assemblies - whether or not they request it. So {smartassembly} intelligently detects when the CPU is idle (or thereabout) and increases or decreases the amount of reserved memory for your assembly according to its requirements - "automated" GC in a sense, except that memory may or may not have ever been in use.

In that same vein, {smartassembly} (with the benefit of literally having access to your source code thanks to the way .NET is designed) marks any and all classes that don't have any detectable "child" classes inheriting from them as "sealed" thereby reducing the amount of memory and CPU used by the CLR during run-time to determine what functions should be made available to other classes and libraries.



同一篇评论有一对“之前/之后”的屏幕截图,显示应用程序从 8M 到 420K。这向我表明,它实际上只是减少了应用程序的工作集,而不是真正的内存需求。如果您最小化应用程序,则会出现相同的“优化”。它不会突然占用更少的内存。我不相信桌面 .NET 框架真的可以只用 420K 运行。

自动密封功能很有趣 - 除了查找虚拟方法外,我看不出它有什么帮助。我怀疑影响是否真的很大,但我当然没有对其进行基准测试。

所以,没有任何结论,但我怀疑它正在做我特别想要的任何事情。

关于.net - SmartAssembly 内存管理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/339862/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com