HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2010
0314
tsuka他のアプリケーションのワーキングセット縮小1解決


tsuka

リンク

2010/3/14(Sun) 14:10:53|NO.31218

他のアプリケーションのプロセスを開き、ワーキングセットの値を変更することで物理メモリ使用量を減らそうと考えたのですが、どうやればいいのでしょう。
確か、Firefox Ultimate Optimizerというソフトが同じようなことを行っていたと思います。

自分で組んでみたものです。メモリ使用量に変化がありません。

//三秒後に最前面のウィンドウのプロセスのワーキングセットを縮小 #uselib "kernel32.dll" #func SetProcessWorkingSetSize "SetProcessWorkingSetSize" int, int, int #func GetProcessWorkingSetSize "GetProcessWorkingSetSize" int, int, int #cfunc OpenProcess "OpenProcess" sptr, sptr, sptr #func CloseHandle "CloseHandle" sptr #uselib "user32.dll" #func GetForegroundWindow "GetForegroundWindow" #func GetWindowThreadProcessId "GetWindowThreadProcessId" int, int onexit *exit wait 300 goto *start stop *start GetForegroundWindow whTarget = stat mes strf("TargetHandle = %d", whTarget) mes "-----------------------------" GetWindowThreadProcessId whTarget, varptr(pId) mes strf("%d = GetWindowThreadProcessId", stat) mes strf("ProcessID = %d", pId) mes "----------------------------" phTarget = OpenProcess(0x400 | 0x010 | 0x001, 0, pId) mes strf("%d = OpenProcess", phTarget) mes "-----------------------------" GetProcessWorkingSetSize phTarget, varptr(iMinSize), varptr(iMaxSize) mes strf("%d = GetProcessWorkingSetSize", stat) mes strf("NormalMinSize = %d, NormalMaxSize = %d", iMinSize, iMaxSize) mes "-----------------------------" SetProcessWorkingSetSize phTarget, 1, 1 mes strf("%d = SetProcessWorkingSetSize", stat) stop *exit SetProcessWorkingSetSize phTarget, iMinSize, iMaxSize CloseHandle phTarget end



この記事に返信する


tsuka

リンク

2010/3/14(Sun) 14:40:09|NO.31221

自己解決しました。
psapi.dllのEmptyWorkingSetを使うことによって実現できました。


//三秒後に最前面のウィンドウのプロセスのワーキングセットを縮小 #uselib "kernel32.dll" #cfunc OpenProcess "OpenProcess" sptr, sptr, sptr #func CloseHandle "CloseHandle" sptr #uselib "user32.dll" #func GetForegroundWindow "GetForegroundWindow" #func GetWindowThreadProcessId "GetWindowThreadProcessId" int, int #uselib "psapi.dll" #func EmptyWorkingSet "EmptyWorkingSet" sptr onexit *exit wait 300 goto *start stop *start GetForegroundWindow whTarget = stat GetWindowThreadProcessId whTarget, varptr(pId) phTarget = OpenProcess(0x400 | 0x100 | 0x010 | 0x001, 0, pId) EmptyWorkingSet phTarget stop *exit CloseHandle phTarget end



ONION software Copyright 1997-2023(c) All rights reserved.