delphi 获得当前进程所使用的内存


本文整理自网络,侵删。

 //delphi 获得当前进程所使用的内存

uses PsAPI ...

//current memory size of the current process in bytes
function CurrentMemoryUsage: Cardinal;
var
pmc: TProcessMemoryCounters;
begin
pmc.cb := SizeOf(pmc) ;
if GetProcessMemoryInfo(GetCurrentProcess, @pmc, SizeOf(pmc)) then
Result := pmc.WorkingSetSize
else
RaiseLastOSError;
end;

To display the memory usage in KB, use:
ShowMessage(FormatFloat('Memory used: ,.# K', CurrentMemoryUsage / 1024)) ;

相关阅读 >>

Delphi使用ixmlhttprequest 简单获取网页源代码

Delphi中关键字inherited

Delphi midstr 返回指定范围内的字符串

Delphi 62 进制的简单实现

Delphi superobject 序列数据集

Delphi根据字符分割字串成数组

Delphi源码简单的实现粘贴复制代码

解决Delphi程序在非中文系统下乱码

Delphi实现保存和读取图片的方法

Delphi 禁止关机的代码

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...