AutoHotkey Community

It is currently May 26th, 2012, 3:39 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 129 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9
Author Message
 Post subject:
PostPosted: February 26th, 2009, 3:48 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
I ran the script with no joystick connected, and with one of the following: an old MS SideWinder Precision Pro, a no-name gamepad ($9.95) and with a UHID joystick controller. The script crashed after: No joystick: 45 min, MS SideWinder: 30 minutes, Gamepad: 5 minutes, UHID: 2 minutes. The errors were something like these:

Unhandled exception at 0x0040ea0a in AutoHotkey.exe: 0xC0000005: Access violation reading location 0x00000018.

Unhandled exception at 0x0040ea8a in AutoHotkey.exe: 0xC0000005: Access violation reading location 0x00000030.

Only this combination of functions looks deadly (Multimedia timer and AHK-timer with joystick calls). If I replace the multimedia timer with another AHK-timer or with DllCall("winmm.dll\joySetCapture", Uint, HostID, Uint,Joy#, Uint,Period, Uint,0), there is no crash. Unfortunately, neither is satisfactory for a music controller script: the AHK-timer is inaccurate for music, joySetCapture stops and cannot be restarted if the joystick gets un/re-plugged.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 9:11 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
I've been running the script in the compiler's debug mode. So far it has been running over 3 hours.

Although it hasn't crashed, that could be explained by some difference between Windows XP and Vista, or some other difference in systems.

Although the VM Size (private set) hasn't increased from its original 2652, the "mem usage" has increased by 56 KB, apparently due to shared and shareable working set increasing, but also in an unexplained rise in "private image size" from 340 to 344. Neither heap nor stack memory has increased in size.

Unfortunately VMMap doesn't show the source of the memory increase. All it reveals is that the memory area at 0x2A0000 has increased from 28 to 56 KB. I looked at the memory there, but unfortunately there is no readable text -- and so no obvious clues about its nature.

I'll keep running it in the hopes that the debugger will reveal the location of any exception that occurs.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 9:33 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Update: MSDN tells that the multimedia timer is obsolete. However, with the recommended replacement (CreateTimerQueueTimer) the memory footprint still grows and the script crashes even faster. It is in Vista-32 SP1, AHK Version 1.0.48.00. (Reducing the Timer function to a single i++ makes no difference.)

In my old laptop (XP SP3, AHK 1.0.47.05) the memory also steadily but very slowly increases (from 2504KB to over 4MB). The script did not crash overnight.

Contrary to my earlier note, a similar script (below) crashed (in Vista) even with the standard AHK timer. The memory shown by the Task Manager grew (2504KB --> ~2812KB), when the script slowed down (the tooltip update almost halted); some furious disk activity occured; and the script crashed in a minute.

The second time I ran the script it recovered from this slow down: it sped up again and the memory increase stopped. Of course, this slowdown renders the script useless, but this recovery is remarkable.

After a crash, the next time the script remains alive noticeably longer. Maybe Windows made room for some resources, and it takes longer to exhaust it.
Code:
CoordMode ToolTip, Screen
VarSetCapacity(JOYINFO,16,0)
DllCall("LoadLibrary", Str,"winmm.dll")
joyGetPos := DllCall("GetProcAddress", UInt,DllCall("GetModuleHandle",Str,"winmm"), Str,"joyGetPos")
SetTimer Sometimes, 33
SetTimer Ipp, 1

!z::ExitApp

Ipp:
   iTimer++
Return

Sometimes:
   JoyTemp =
   Loop 16
      JoyTemp .= DllCall(joyGetPos, Uint,A_Index-1, Uint,&JOYINFO) = 0
   tooltip (%iTimer%/%A_Now%) %JoyTemp%, 0,0,20
Return


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 10:00 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Thanks for the info.

If I should switch over to the new script, let me know. Otherwise I'll keep the other one running a while, perhaps 24 hours or so.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2009, 5:16 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
After trying hundreds of variants I realized that the problem is in WinMM\joyGetPos, not in AHK. If I replace joyGetPos with joyGetPosEX, there is no memory leak (although no notification on joystick availability, either). The solution is simple: Call joyGetPos only when necessary (on message WM_DEVICECHANGE), not in a timer or in a loop. Although the memory footprint still increases at un/plugging joysticks, it is not enough to crash the script.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2009, 2:39 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Although it's a relief that there's no bug in AutoHotkey in this case, I think its good that cases like this be fully investigated (as you did) to ensure that the program operates reliably at a low level.

Thanks for the follow-up.


Top
 Profile  
Reply with quote  
 Post subject: Application Error
PostPosted: March 19th, 2009, 6:36 am 
Reporting queued error: faulting application explorer.exe, version 6.0.3790.3959, faulting module ntdll.dll, version 5.2.3790.3959, fault address 0x0004afb2.

Hi Guys installed the AHK version on Server 2003 and it caused the above error every time I restarted the computer.

Uninstalled and no longer have the error, no idea why I just uninstalled programs installed at the time till it stopped happening.


Top
  
Reply with quote  
 Post subject: Re: Application Error
PostPosted: March 19th, 2009, 6:39 am 
Anonymous wrote:
...I just uninstalled programs installed at the time till it stopped happening.

...ok re-install AHK & make sure it comes back?


Top
  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2009, 3:02 am 
Reporting queued error: faulting application explorer.exe, version 6.0.3790.3959, faulting module ntdll.dll, version 5.2.3790.3959, fault address 0x0004afb2.


Hi Guys re-installed the current AHK version on Server 2003 and it was ok, then installed the beta and the error came back. My biggest issue after reading about the above error is that it has so many different cause's possible. Eg conflict between two programs, Ram fault, DEP error

From all I read you could have two machines that are almost identical and one could error and the other won't.

** Removed the Beta and put it back to current version error didn't occur.

The installed programs in-case it is a conflict

ATI Display Driver
eSignal (Charting package)
Intel Pro Network Conn Drivers
Logmein
MS .NET 2.0 sp2
MS .NET 3.0 sp2
MS .NET 3.5 sp1
MSXML 6 sp 2
IE 7
win search 4.0
win server 2003 sp2


Hardware
(Dell 1425sc)
Intel Xeon 2.8
2GB Ram

If you need any other information let me know,

Tim


Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 129 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group