AutoHotkey Community

It is currently May 27th, 2012, 12:54 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: January 23rd, 2006, 4:40 pm 
Current situation:
a) Start an application
b) during multiple file processing the available "Physical Memory" decreases to a level of about 120000K
c) as a result that application collapses with an "out of Memory"-error
d) freeing memory with something like this ...
FreeMem.vbs
Code:
FreeMem = Space(128000000)
won't make it directly as the application rejects to go on processing without being reinitialised/restartet.

For that reason I wanna monitor the process via AHK's DllCall() function, using kernel32.dll's GlobalMemoryStatus function. Unfortunatley that function delivers its outcome to a structure (MEMORYSTATUS), which looks to me that I can't access/parse it to my needs. Any idea?

MSDN: [url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp[/url][GlobalMemoryStatus][/url]

In Deitsch :wink:
ich hab die Frage auch im Deutschen Forum gepostet. Irgendwelche D(ll)-Patrioten hier inkognito unterwegs ?? :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 23rd, 2006, 5:13 pm 
Offline

Joined: December 22nd, 2005, 7:43 pm
Posts: 245
Wouldn't a simple "SetTimer - Reload" be sufficient?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 23rd, 2006, 5:27 pm 
I might have lost you but the reload is used to reload an AHK script (AFAIKTFM). If that would work regarding the system, I additionaly would have to face a following login procedure for the collapsed/terminated app. Therefore I would prefer to refresh the system before the target app will be impacted by a memory issue.

Thx for you contribution. :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 23rd, 2006, 5:47 pm 
Offline

Joined: December 22nd, 2005, 7:43 pm
Posts: 245
I assumed by "application" you meant ahk script. If that is the case, then a reload would presumably restore the memory. (unless ahk has a memory leak). Otherwise, I can't be of any help.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 23rd, 2006, 7:39 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
This gives you the percentage of the used memory vs. the total physical memeory
Code:
VarSetCapacity( memorystatus, 100 )
DllCall("kernel32.dll\GlobalMemoryStatus", "uint",&memorystatus)
mem := *( &memorystatus + 4 )    ; 0..100%
MsgBox %mem%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 23rd, 2006, 8:07 pm 
Offline

Joined: September 25th, 2005, 4:31 pm
Posts: 610
Check antonyb's implementation.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2006, 12:13 am 
Thx gents. :D
While I've investigated the meaning of some pseudo cryptic aka "Ich versteh hier nur Bahnhof" parts of the given code, I felt ashamed a little :oops:. Right at the DllCall help page there's a paragraph: Structures and Arrays :shock:.
OMG, BoBo RTFM :roll: Nevertheless, it has needed samples like yours, to clearify in detail different aspects which would have been difficult to identify without them.
Thanks again. Much appreciated 8)


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, chaosad, MSN [Bot] and 21 guests


You can 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