Jump to content

Memory leak?


Recommended Posts

For some reason when i run this its memory usage just goes up by about 44 kb or so a second.

#include <dir.au3>

Global $x = 1
Global $y = 0
Global $sleep = 100
IniWrite($dir, "Vars", "varx", $x)
IniWrite($dir, "Vars", "vary", $y)
HotKeySet("{down}", "down")
HotKeySet("{up}", "up")
HotKeySet("{left}", "left")
HotKeySet("{right}", "right")

While 1
Sleep($sleep)
processed()
iniw()
WEnd

Func Iniw()
IniWrite($dir, "Vars", "varx", $x)
IniWrite($dir, "Vars", "vary", $y)
EndFunc   ;==>Iniw

Func processed()
Global $processed = IniRead($dir, "Process", "Input", "")
EndFunc   ;==>processed

Func down()
If $processed = 1 Then
$x = Int($x + 1)
If $x = 5 Then
$x = 4
Else
EndIf
EndIf
IniWrite($dir, "Process", "Input", "0")
EndFunc   ;==>down

Func up()
If $processed = 1 Then
$x = Int($x - 1)
If $x = 0 Then
$x = 1
Else
EndIf
EndIf
IniWrite($dir, "Process", "Input", "0")
EndFunc   ;==>up

Func right()
If $processed = 1 Then
$y = Int($y + 1)
If $y = 97 Then
$y = 96
Else
EndIf
EndIf
IniWrite($dir, "Process", "Input", "0")
EndFunc   ;==>right

Func left()
If $processed = 1 Then
$y = Int($y - 1)
If $y = -1 Then
$y = 0
Else
EndIf
EndIf
IniWrite($dir, "Process", "Input", "0")
EndFunc   ;==>left

Any help with my problem or others you see please feel free to tell me what i screwed up :oops:

Link to comment
Share on other sites

Im not entirely sure I know how to rewrite it with out useing that variable like that... I use this script to communicate with another via a ini file and that is used so when the other script reads the change in the ini file it outputs a 1 for "processed" and after this script makes a change it puts a 0 in so nothing else in this script runs until the other script reads the change

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...