Page 1 of 1

COM object CPU leak in Win 10

Posted: 11 Jul 2019, 20:39
by pneumatic
This only occurs on my Windows 10 install (v1903 May 2019). Windows 7 appears unaffected.

Code is from https://www.autohotkey.com/docs/commands/URLDownloadToFile.htm

(it just downloads the current version number of ahk from https://autohotkey.com/download/1.1/version.txt)

Code: Select all

#Persistent
return

^1::  ;Ctrl+1
req := ComObjCreate("Msxml2.XMLHTTP")
	; also try Msxml2.XMLHTTP.3.0 , Msxml2.XMLHTTP.6.0 , Msxml2.ServerXMLHTTP
	; Msxml2.ServerXMLHTTP.3.0 , Msxml2.ServerXMLHTTP.6.0 , Microsoft.XMLHTTP 
req.open("GET", "https://autohotkey.com/download/1.1/version.txt", true)
req.onreadystatechange := Func("Ready")
req.send()
return


Ready(){
global req
    
	if (req.readyState != 4)  ; Not done yet.
		return
	if (req.status == 200) ; OK.
		MsgBox % "Latest AutoHotkey version: " req.responseText
	else
		MsgBox 16,, % "Status " req.status
	
	req.abort()  
	req := ""
}
When the script is launched, CPU usage is zero as it should be:

Image

Press Ctrl+1 to download the file

Image

Download complete, but now CPU usage is pegged at 0.02

Image

It seems that some thread belonging to the COM object must still be alive and needs to be released or closed the right way?

I've tried disconnecting the ComObj from events with ComObjConnect() and releasing its interface pointer with ObjRelease() (after getting it with ComObjType() and ComObjQuery() ).

Re: COM object CPU leak in Win 10  Topic is solved

Posted: 12 Jul 2019, 06:14
by swagfag
its not doing it on my computer
Spoiler
the only time cpu time is consumed is (1) when the script is first launched, (2) when the xmlhttprequest is made, (3) when msgboxes show up and when u interact with them(move, mouseover, destroy)

Re: COM object CPU leak in Win 10

Posted: 12 Jul 2019, 06:42
by pneumatic
Thanks.

I guess it must be something about my system configuration causing it. I will try a fresh install of Windows.

Re: COM object CPU leak in Win 10

Posted: 12 Jul 2019, 20:42
by pneumatic
Found the culprit, it was the motherboard's ethernet controller driver ("Killer E2200 Gigabit Ethernet Controller"). Motherboard is an Asrock Z97X Killer. I already knew that Killer ethernet software was dodgy as its "bandwidth control" feature was randomly turning itself on and throttling my network traffic to a few mbps.