Jump to content

Help me with memory leak please


Recommended Posts

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
Link to comment
Share on other sites

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


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

Link to comment
Share on other sites

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


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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...