Jump to content
Sign in to follow this  
fatalvn

Help me with memory leak please

Recommended Posts

fatalvn

Hi everyone, I have a problem while reading memory, everything goes fine reading values from memory here. But after about 1 or 2 hours, my swap/RAM go up to full and my computer just get hang, everything is freezed, I have to reset my computer.

Could you please read the code and tell me why I have memory leak? As you can see there I have _MemoryClose, even clear the label for reduce memory, and even empty working set of all program, but the result is: the "xxx.exe" only take up about 50-100MB, that's normal, but the RAM usage and SWAP file keep getting bigger till computer freezed, why is that?

P/s: I've spent over 2 days on this forum finding posts about memory leak, all I can get is empty working set, but it's no use, i still can not figure out why I have this memory leak, so please help me if you can :sweating:

here the code:

Global $abc_addr
Global $abc

$abc_addr = 0x00112233 ;just an example



Func read_abc()

$openmem = _MemoryOpen(ProcessExists("xxx.exe"))
$abc = _MemoryRead($abc_addr, $openmem)
_MemoryClose($openmem)

GUICtrlSetData($abc_show, "") ;label
GUICtrlSetData($abc_show, $hp) ;label


Sleep(300)
EndFunc ;==>read_abc




Func get()
Sleep(200)
         read_abc()
         If $abc < 1000 Then
                 ;do shit
         EndIf

     reducememory() ;this one will empty working set of some programs, xxx.exe for details
EndFunc ;==> get



While 1
         get()
WEnd
Edited by fatalvn

Share this post


Link to post
Share on other sites
BigDod

Have you read the rules (link at bottom right) particularly about game automation



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites
fatalvn

not yet sir, but i edited it, can you help me please o:)

Share this post


Link to post
Share on other sites
BigDod

Editing it makes no difference, you will get no help with this.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.