Visual Studio 2008 在长时间空闲后爬行

发布于 2024-08-02 18:22:38 字数 489 浏览 5 评论 0原文

人家怎么了。

有些事情已经困扰我一段时间了......我想知道你们中是否有人知道解决这个问题的方法。

我正在开发的 C# 解决方案是一个庞大的解决方案,包含大约 20 个项目和几乎相同数量的单元测试项目。每个项目包含数百个文件。因此打开和关闭解决方案需要一段时间......但一旦打开,一切都很好。

但是,如果我让计算机过夜(我的解决方案仍然在 VS 中打开)并在第二天早上回来,那么在接下来的半小时内我在 VS 中执行的所有操作都会非常慢左右。

我知道为什么会发生这种情况...这是因为 Windows 似乎从内存 (RAM) 中删除了空闲进程。当我在 VS 中执行某些操作时,它会从页面文件中获取数据并将其放回内存中,这会减慢我执行的所有单个操作,直到进程的内存在 RAM 中完全恢复。

所以我的问题是,有没有办法告诉 Windows VS 是一个高优先级进程/应用程序,并将该进程的内存保留在 RAM 中?

预先感谢,

-奥利

What's up people.

Something's been bothering me for a while now... and I was wondering if any of you might know of a workaround for this.

The C# solution im working on is a huge solution that contains about 20 projects and almost the same amount of unit test projects. Each projects contains hundreds of files. So opening and closing the solution takes a while... but once it's opened, everything is fine.

But, if I leave my computer up for the night (with my solution still opened in VS) and come back the next morning, everything I'll do in VS will be very slow for the next half hour or so.

I know why this happens... it's because Windows seems to remove idle processes from memory (RAM). And when I do something in VS, it takes the data from the pagefile and puts it back in the memory which slows everything single operations I do till the process' memory has been fully restored in RAM.

So my question is, is there a way to tell Windows that VS is a high priority process/application and to leave that process' memory in RAM?

Thanks in advance,

-Oli

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

薔薇婲 2024-08-09 18:22:38

我认为这是不可能的。 OTOH,您可以将计算机置于磁盘挂起模式。这几乎会冻结它的状态,就像你离开时一样(即:RAM 中的 VS),并在你开始工作时将其恢复到相同的状态。作为额外的奖励,您将有助于节约能源,从而可能拯救地球。

I don't think this is possible. OTOH, you could put your computer in suspend-to-disk mode. That would pretty much freeze its state as it is when you leave (that is: VS in RAM) and restore it to the same when you start working. As an additional bonus, you would help to conserve energy and thus might save the earth.

挖鼻大婶 2024-08-09 18:22:38

您可以根据 这篇 文章来提高优先级,但我不知道它是否会执行您所描述的操作用于进程的内存。

另外,仅出于性能考虑,您可以考虑使用 SSD 驱动器来替换硬盘驱动器(如果您还没有这样做)。我的一个朋友向我展示了他的带有 SSD 的新笔记本电脑,它在一分钟内启动到 Windows,并在不到 5 秒的时间内打开 VS。

当然,直接从开始菜单打开 VS,打开这么大的项目至少会快得多。

You could alter your VS shortcut according to this article to boost the priority, but I don't know whether it would do what you describe for the process' memory.

Also solely for performance sake you could consider getting an SSD drive to replace your hard drive, if you haven't already. A friend of mine showed me his new laptop with an SSD onboard and it booted into Windows under a minute, and opened VS in less than 5 seconds.

Granted that was opening VS straight from the start menu, opening that huge a project hopefully would at least be significantly faster.

手长情犹 2024-08-09 18:22:38

AFAIK,更改进程优先级并不能解决问题,因为瓶颈似乎是 I/O 而不是 CPU 时间。如果问题影响了您的工作效率,那么再购买几 G 的 RAM 是非常值得的(多少取决于您的操作系统和预算)。如果您可以获得大约 3-4GB 的 RAM,您甚至可以消除交换文件(或接近消除它)。这将防止 VS 在空闲时下沉。

另一种选择是创建一个工具来遍历 VS 的堆,将其强制进入主内存。这可以通过编写插件或代码注入来完成。在开始工作之前先运行它,一旦开始工作,VS 就会启动。然而,这需要一些工作,并且您可能会获得比实际需要的内存更多的内存(即使您照常工作,与其他进程一样,VS 的一些内存也位于交换文件中)。

AFAIK, changing the process priority won't solve the problem, as the bottleneck seems to be I/O rather than CPU time. If the problem hurts your productivity, it would be well worth it to just buy a few more Gs of RAM (how much depends on your OS and budget). If you can get about 3-4GB of RAM, you can even eliminate the swap file (or close to eliminate it). This will prevent VS from sinking when idle.

Another option would be to create a tool that will walk VS's heap, forcing it into the main memory. This can be done by writing an add-in or by code injection. Have it run before you get to work, and you'll have VS up and about once you get to it. It will, however, require some work, and you might get more than you actually need in memory (some of VS's memory is in the swap file even when you work as usual, as with every other process).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文