Jump to content

Recommended Posts

Posted

From: http://www.autoitscript.com/autoit3/docs/intro/ComRef.htm

When you assign an Object variable a different value, the 'pointer' will automatically be released. You can, for instance, force deletion of an Object by assigning it any number or any text value.

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")  ; Object is created
$oHTTP = 0                                        ; Object is deleted
But when i use ObjCreate in my script (in this case "ImageMagickObject.MagickImage.1") the memory usage of my script goes up (1k) but it wont go down after releasing the object.

is there anyway to get completely rid of this?

PS: creating the object again after "releasing" it does not cause memory usage to go up again

Posted (edited)

Thanks for the pointer, i think something in here will proof usefull :-)

[Edit:] The solution i used:

Func _ObjRelease(ByRef $Object)
    $Object = 0
    Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', @AutoItPID)
    Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
    DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
    Return $ai_Return[0]
EndFunc   ;==>_ObjRelease

thanks to this post

Edited by Djarlo

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
×
×
  • Create New...