vb.net Windows 应用程序的 RAM 内存使用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27684486/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ram Memory Usage for Windows Application
提问by Please help me
I am doing a project using windows application VB.net Framework. I would like to inquire about how to control the RAM usage , memory usage for the application as i would not want to jam up my clients computer. Is there any codes that is available for grabs ? I have been looking around but couldnt find any.
我正在使用 Windows 应用程序 VB.net Framework 做一个项目。我想询问如何控制应用程序的 RAM 使用量和内存使用量,因为我不想阻塞我的客户端计算机。有没有可以抢的代码?我一直在环顾四周,但找不到任何东西。
Thank you
谢谢
回答by Bjoern
What have you tried so far? It should work something like this:
你都尝试了些什么?它应该像这样工作:
Dim x As Process = Process.GetCurrentProcess()
Dim inf As String
inf = "Mem Usage: " & x.WorkingSet / 1024 & " K" & vbCrLf _
& "Paged Memory: " & x.PagedMemorySize / 1024 & " K"
MessageBox.Show(inf, "Memory Usage")
Feel free to adjust to your needs.
随意调整以适应您的需求。

