Joystick key causes huge memory leak (how to repro inside)

Report problems with documented functionality
bolero
Posts: 1
Joined: 11 Feb 2017, 01:09

Joystick key causes huge memory leak (how to repro inside)

11 Feb 2017, 01:19

Hi all. Here is the script I am using:

Joy10::
Send {K down}
KeyWait Joy10
Send {K up}
return


Very simple script, however, it causes huge memory leak, indicated by "Handles" on the task manager (can easily get to over a hundred thousand in a few hours). This is caused ONLY if the script is loaded with the controller turned off. It starts leaking memory UNTIL the controller it turned on, at which point it stops even if you turn the controller off (until the script is loaded again).

How to reproduce:
1) Plug (Xbox 360 wireless, in my case) controller to PC. Do not turn it on.
2) Load a script that uses a controller key, like the one above. Notice how the handles will start going up very quickly on the task manager.
3) Turn controller on. Handles will now stop going up, even if controller is turned off.


Kind regards.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Joystick key causes huge memory leak (how to repro inside)

11 Feb 2017, 03:02

See https://autohotkey.com/boards/viewtopic ... 88#p122088

It's a Windows bug. The bug can be reproduced by merely calling joyGetPos repeatedly.

Code: Select all

if !DllCall("GetModuleHandle", "str", "winmm")
    MsgBox Winmm.dll not loaded!  ; Should never happen.

; The JOYINFO struct receives only the X, Y and Z positions and button states.
VarSetCapacity(ji, 16)

while DllCall("winmm\joyGetPos", "uint", 0, "ptr", &ji) != 0
    Sleep 50

MsgBox Joystick 0 (1Joy) is connected.
AutoHotkey never allocates or receives any handles or heap memory for joystick polling.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 23 guests