Jump to content

Freeing memory up


Recommended Posts

add this function to your script and call the function

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()

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

is this a problem with autoit? memory not being automatically freed up?  Just asking 'cause i hadn't noticed it before, but honestly never really looked either

<{POST_SNAPBACK}>

I haven't either, but I use that for alot of other applications i.e. MS apps leave foot prints all over the place.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Should make correction to that, if using the beta and DllStructs, and one forgets to delete the structs the memory is still used. There may be other instances where incorrect coding will result in memory not being freed up.

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Should make correction to that, if using the beta and DllStructs, and one forgets to delete the structs the memory is still used.  There may be other instances where incorrect coding will result in memory not being freed up.

Gary

<{POST_SNAPBACK}>

You're right forgot about that, thanx :)
Link to comment
Share on other sites

I haven't either, but I use that for alot of other applications i.e. MS apps leave foot prints all over the place.

<{POST_SNAPBACK}>

Microsoft programs wasting system resources?! Blasphemy. </sarcasm> Thanks for the response, i hadn't even considered possible side effects of not deleting structs etc, but luckily i don't use them much...
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...