DotNET应用程序的内存使用情况 [英] Memory usage of DotNET app

查看:211
本文介绍了DotNET应用程序的内存使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序(DotNET)在C ++独立应用程序中作为插件运行,该应用程序公开了C ++/CLI SDK.

My application (DotNET) runs as a plug-in inside a C++ standalone app that exposes a C++/CLI SDK.

对于我的用户而言,生成大量数据非常容易,并且如果我的插件+基本应用程序的内存消耗达到法定最大限制的90%,我想提供一个中止选项.

It is very easy for my users to generate large amounts of data and I'd like to offer an abort option if the memory consumption of my plug-in + the base application reaches -say- 90% of the legal maximum.

如何测量总内存消耗(理想情况下是托管非托管代码),如何知道当前应用程序允许多少内存窗口?

How can I measure the total memory consumption (ideally for both the managed and unmanaged code) and how do I know how much memory windows allows for the current application?

推荐答案

Process类提供了大多数此类信息.我认为您需要的是 Process.PrivateMemorySize64 .

The Process class provides most of this information. I think what you're after would be Process.PrivateMemorySize64.

您应该能够:

var memoryUsage = Process.GetCurrentProcess().PrivateMemorySize64;

这篇关于DotNET应用程序的内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆