For 32-bit it should beif (NumGet(addr + 68, "ptr") = PID)
Will add 32-bit later too.. because I just work with 64-bit
Process Private Memory Usage Topic is solved
Re: Process Private Memory Usage
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
Re: Process Private Memory Usage Topic is solved
For 32- & 64-Bit
Full function -> https://www.autohotkey.com/boards/viewtopic.php?f=6&t=62989
Code: Select all
MsgBox % GetWorkingSetPrivateSize(2580) " K"
GetWorkingSetPrivateSize(PID)
{
if (DllCall("ntdll.dll\NtQuerySystemInformation", "int", 0x5, "ptr", 0, "uint", 0, "uint*", size) != 0) {
size := VarSetCapacity(buf, size, 0)
if (DllCall("ntdll\NtQuerySystemInformation", "int", 0x5, "ptr", &buf, "uint", size, "uint*", 0) != 0)
return (ErrorLevel := 2) & 0
addr := &buf
while (addr) {
if (NumGet(addr + 56 + A_PtrSize * 3, "ptr") = PID)
return NumGet(addr + 8, "int64") // 1024
if !(NumGet(addr + 0, "uint"))
break
addr += NumGet(addr + 0, "uint")
}
}
return (ErrorLevel := 1) & 0
}
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
- Blue Kodiak
- Posts: 26
- Joined: 17 Mar 2019, 00:45
Re: Process Private Memory Usage
Totally Awesome.
Re: Process Private Memory Usage
Is there any way to empty the Private Memory?
Re: Process Private Memory Usage
You might want to look at this thread:
https://autohotkey.com/board/topic/30042-run-ahk-scripts-with-less-half-or-even-less-memory-usage/
(Run AHK scripts with less (half or even less) memory usage)
Code: Select all
EmptyMem(PIDtoEmpty)
{
h:=DllCall("OpenProcess", "UInt", 0x001F0FFF, "Int", 0, "Int", PIDtoEmpty)
DllCall("SetProcessWorkingSetSize", "UInt", h, "Int", -1, "Int", -1)
DllCall("CloseHandle", "Int", h)
}
Re: Process Private Memory Usage
Working Set is ok but Private Bytes is not shrunk. Maybe because it's impossible anyway.SOTE wrote: ↑23 Nov 2020, 17:14You might want to look at this thread:
https://autohotkey.com/board/topic/30042-run-ahk-scripts-with-less-half-or-even-less-memory-usage/
(Run AHK scripts with less (half or even less) memory usage)
Code: Select all
EmptyMem(PIDtoEmpty) { h:=DllCall("OpenProcess", "UInt", 0x001F0FFF, "Int", 0, "Int", PIDtoEmpty) DllCall("SetProcessWorkingSetSize", "UInt", h, "Int", -1, "Int", -1) DllCall("CloseHandle", "Int", h) }
Thansk.
Re: Process Private Memory Usage
Can you try this function?
https://github.com/jNizM/MemoryInfo/blob/master/src/MemoryInfo.ahk#L78
Or take a look in these 2 tools from Sysinternals:
https://docs.microsoft.com/en-us/sysinternals/downloads/rammap
https://docs.microsoft.com/en-us/sysinternals/downloads/vmmap
https://github.com/jNizM/MemoryInfo/blob/master/src/MemoryInfo.ahk#L78
Or take a look in these 2 tools from Sysinternals:
https://docs.microsoft.com/en-us/sysinternals/downloads/rammap
https://docs.microsoft.com/en-us/sysinternals/downloads/vmmap
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
Re: Process Private Memory Usage
It did not work for Private Bytes. It has an effect on total memory but has no effect on Private Bytes. I have to radically change my application approach and find a different solution.jNizM wrote: ↑26 Nov 2020, 03:17Can you try this function?
https://github.com/jNizM/MemoryInfo/blob/master/src/MemoryInfo.ahk#L78
Or take a look in these 2 tools from Sysinternals:
https://docs.microsoft.com/en-us/sysinternals/downloads/rammap
https://docs.microsoft.com/en-us/sysinternals/downloads/vmmap
I was collecting hundreds of thousands of file paths in a single object. And when I needed I could compare quickly. But it has a heavy impact on memory. I will reduce the file paths to 8 bytes with the CRC32 function you made to save memory. I hope this is a logical way. If I thought the CRC16 would be sufficient for this job, my choice would be different.
Who is online
Users browsing this forum: No registered users and 337 guests