Jump to content

Recommended Posts

Posted

Hi!

I have a potential problem of memory leakage in the script I wrote and wonder if anyone will be able to suggest a potential source of the problem?

The script is desgined to log into secure website and constantly send HTTP GET request to obtain a list of tasks the client has assigned to us (the tasks are auctions, so swift actions are neccessary, hence the script) and then occasionally send HTTP POST to accept certain tasks based on certain criteria. It works 24/7 and works alright, but I noticed that amount of RAM it uses will increase significantly over time (say, it jumps from 20 000 K to 100 000 K in a few days).

I cannot post the entire script: it modestly big, also might contatin some sensetive information. But here's the main loop (like, exactly):

While True
    If Script_SignIn() And Script_GetTasks() Then Script_AcceptTasks()

    Sleep(10)
WEnd

The Script_ functions are here just to simplify the structure, they don't pass any parameters to each other, just return True \ False when finished and change some global variables when executed. Entire GUI is in OnEvent mode.

TMS_ functions are where the actual work is done, names are self-explanatory:

  • TMS_SignIn($sURL, $sUsername, $sPassword) -- returns $sAuthKeys (used subsequently in other functions to authenticate yourself, while session is active).
  • TMS_GetTasks(ByRef $oHTTP, $sURL, $sAuthKeys) -- this function is running constantly returning $avTasks (basically a table with all information I need to accept them), I'm passing a global variable $g_oHTTP to it, it creates HTTP object only once per session (hence ByRef, I don't want to locally create HTTP object at every pass, just create once and reuse) and in next loop I pass the object the function created to it again, $g_oHTTP is destroyed when session has ended and recreated in next loop after re-login.
  • TMS_AcceptTasks(ByRef $avTasks, $sURL, $sAuthKeys) -- returns True\False (changes $avTasks table slightly -- the status of acceptance if it's successful).
  • TMS_SignOut($sURL, $sAuthKeys) -- returns True\False.

These functions create local HTTP and HTML objects inside as well, I even "= 0" them at the end, even though I don't think I need to do this, since they are local variables. Still the problem persists.

Any ideas where to look?

  • Moderators
Posted

The issue is on line 12 :)

Seriously, you cannot expect to post only 4 lines of code showing function calls, which by your own description are not interacting with one another, and expect people to diagnose and troubleshoot something as transient as a memory leak. Help us help you by providing more information.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted (edited)

@JLogan3o13, well, I was hoping there's some guide like memory leakage in AutoIt for dummies.

Ok, here's the script. I've removed some sensetive information. It's fully functional, though it won't leak memory until it's sending HTTP requests constantly, and for that I need to provide credentials, which of course I can't do.

The issue might be in some parts I've borrowed (check credits inside), say, I'm not quite understand ProgAndy's ASM gibberish in the TrayNotify.au3.

 

Edited by mjolnirmarkiv

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