如何得到当前程序的内存使用情况?积极积极积极积极
newyj 2001-08-24 12:26:33 用GetProcessWorkingSetSize行吗?
我用3种方法得到当程序的句柄
Processid := GetCurrentProcessId;
Processid := GetCurrentProcess;
Processid := application.Handle;
然后:
if GetProcessWorkingSetSize(Processid, size1, size2) then
begin
writeln(txt, inttostr(size1));
writeln(txt, inttostr(size2));
end
else
begin
case GetLastError of
ERROR_INVALID_HANDLE: writeln(txt, '无效的句柄作为一个参数传递');
ERROR_CALL_NOT_IMPLEMENTED: writeln(txt, '在win 95下调用专为win nt设计的win32 api函数');
ERROR_INVALID_PARAMETER: writeln(txt, '函数中有个参数不正确');
end;
end;
只有GetCurrentProcess能成功 其它都是ERROR_INVALID_HANDLE
但得到的内存值无变化;不论我启动多少线程;还是 用getmem(p,300000);都无变化