ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Application memory limiter

<< < (2/3) > >>

Ath:
Hm, I'm a bit worried you need to limit the memory use of any software. The software involved should use, and get, any available memory it needs.
How are you to decide how much memory that application should be using? :-\

If memory usage is an issue, because it is really excessive, you'd optimally signal the makers of that software, and ask them to 'fix' the issue, not limit the application and possibly cripple or crash it.
Switching to some alternative that uses less memory is also a possible solution.

vbmark:
I am a software developer troubleshooting a large application that has a problem with a runaway memory leak.  I cannot always keep my eye on the memory usage and if I don't catch it when it starts to run it eats up my memory, hangs my computer, and I must do a hard reboot.

I don't have time to create this little app myself and I thought it would be simple for someone to make -- just loop through each running process and see if its memory usage is above the set limit.

In my case I know that if the executable hits one gig of working memory then it's running away and will soon consume all that's left.  If I could stop it at one gig it would make my life easier.

skwire:
Here is a QnD (Quick 'n Dirty) AutoHotkey script that watches an executable name and fires off a message box if memory usage of the process exceeds one gig.  Obviously, change firefox.exe to your required executable name.


--- Code: Autohotkey ---#PersistentExeName := "firefox.exe"SetTimer, MemWatcher, 10000 Return ; End of auto-execute section.  MemWatcher:{    myMem := GetProcessMemoryInfo( ExeName )    If ( myMem > 1048576 )    {        MsgBox, 48, Alert!, Memory exceeded for %ExeName%    }}Return  GetProcessMemoryInfo( pName ) ; http://www.autohotkey.com/forum/post-223061.html#223061{   Process, Exist, %pname%   pid := Errorlevel    ; get process handle   hProcess := DllCall( "OpenProcess", UInt, 0x10|0x400, Int, false, UInt, pid )    ; get memory info   VarSetCapacity( memCounters, 40, 0 )   DllCall( "psapi.dll\GetProcessMemoryInfo", UInt, hProcess, UInt, &memCounters, UInt, 40 )   DllCall( "CloseHandle", UInt, hProcess )    list = cb,PageFaultCount,PeakWorkingSetSize,WorkingSetSize,QuotaPeakPagedPoolUsage   ,QuotaPagedPoolUsage,QuotaPeakNonPagedPoolUsage,QuotaNonPagedPoolUsage   ,PagefileUsage,PeakPagefileUsage    /*   cb := NumGet( memCounters, 0, "UInt" )   PageFaultCount := NumGet( memCounters, 4, "UInt" )   PeakWorkingSetSize := NumGet( memCounters, 8, "UInt" )   WorkingSetSize := NumGet( memCounters, 12, "UInt" )   QuotaPeakPagedPoolUsage := NumGet( memCounters, 16, "UInt" )   QuotaPagedPoolUsage := NumGet( memCounters, 20, "UInt" )   QuotaPeakNonPagedPoolUsage := NumGet( memCounters, 24, "UInt" )   QuotaNonPagedPoolUsage := NumGet( memCounters, 28, "UInt" )   PagefileUsage := NumGet( memCounters, 32, "UInt" )   PeakPagefileUsage := NumGet( memCounters, 36, "UInt" )   */    n=0   Loop, Parse, list, `,   {      n+=4      SetFormat, Float, 0.0 ; round up K      this := A_Loopfield      this := NumGet( memCounters, (A_Index = 1 ? 0 : n-4), "UInt") / 1024       ; omit cb      If A_Index != 1         info .= A_Loopfield . ": " . this . " K" . ( A_Loopfield != "" ? "`n" : "" )   }     ; Return "[" . pid . "] " . pname . "`n`n" . info ; for everything   Return WorkingSetSize := NumGet( memCounters, 12, "UInt" ) / 1024 ; what Task Manager shows}

ruskiem:
Thank You skwire, but thats not it.
its 2014, yeas, but that can be still very usefull.
i need that too, like ProcessTammer for CPU, we need similar for RAM Memory

even just as simple as that:

"Minimum requirement: Prevent any application from using more than X amount of memory.

When limit reached options:
1) Automatically close the application."

Please anybody know about such thing or can MacGyver it in xx minutes?

Thank You
Waiting for reply
Best Regards!

mouser:
Possibly evolveable: https://www.donationcoder.com/forum/index.php?topic=36915.0

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version