Jump to content
Sign in to follow this  
Enforcer

Process memory limit or flush

Recommended Posts

Enforcer

I have mini game called Tribes-X (NFK Mod if you heard) and this game flooding memory or dont know how to explaine, when playing for a long time with meny players, process eating memory more and more then game simple showing error like (not enough memory or something like that) i don't have sources of that game and can't fix this bug, so here is the question:

Can I somehow flush the memory sometimes for that process ???

Didn't find help on on autoit help file and on internet eather.

If someone know how to do this pleas help, cose we cant play for long time, cause that error...

Need autoit or Delphi Example...

sorry for my English...

Edited by Enforcer

[RU] Zone

Share this post


Link to post
Share on other sites
Emiel Wieldraaijer

Hi,

i don't know if this helps

;call before while/loop

_ReduceMemory()

Func _ReduceMemory($i_PID = -1)
    If $i_PID <> -1 Then
        Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
        DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
    Else
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
    EndIf
    Return $ai_Return[0]
EndFunc   ;==>_ReduceMemory

Or take a look at MrBond007 Memory Fusion

http://www.autoitscript.com/forum/index.ph...l=Memory+Fusion

Good Luck

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
wolf9228

I have mini game called Tribes-X (NFK Mod if you heard) and this game flooding memory or dont know how to explaine, when playing for a long time with meny players, process eating memory more and more then game simple showing error like (not enough memory or something like that) i don't have sources of that game and can't fix this bug, so here is the question:

Can I somehow flush the memory sometimes for that process ???

Didn't find help on on autoit help file and on internet eather.

If someone know how to do this pleas help, cose we cant play for long time, cause that error...

Need autoit or Delphi Example...

sorry for my English...

#Include <WinAPI.au3>
#Include <Constants.au3>





$mem = ProcessGetStats()
MsgBox(0,"GetProcessWorkingSetSize", "WorkingSetSize ==> " & $mem[0]  _
& @CRLF & "PeakWorkingSetSize ==> " & $mem [1])


$Kernel32 = DllOpen("Kernel32.dll")
$hProcess = _WinAPI_GetCurrentProcess()
$bool = SetProcessWorkingSetSize($hProcess,($mem [1] + $mem[0]), ($mem [1] + $mem[0]) * 2)
MsgBox(0,"GetProcessWorkingSetSize",$bool)







;http://msdn.microsoft.com/en-us/library/ms686234(VS.85).aspx
Func SetProcessWorkingSetSize($hProcess,$dwMinimumWorkingSetSize _
, $dwMaximumWorkingSetSize)
$DllCall = DllCall($Kernel32,"int","SetProcessWorkingSetSize","hwnd",$hProcess, _
"long", $dwMinimumWorkingSetSize,"long",$dwMaximumWorkingSetSize)
Return $DllCall[0]
EndFunc

DllClose($Kernel32)

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×