AHKhttp icon indicating copy to clipboard operation
AHKhttp copied to clipboard

Crashes after a while (memory leak?)

Open wywywywy opened this issue 6 years ago • 7 comments

Hi,

There's a memory leak somewhere, even when using the example scripts.

After receiving some amount of requests (1000? 2000?) it will crash.

I am not sure if the problem is in AhkHttp.ahk or AhkSock.ahk.

I guess maybe an object or array is not cleared somewhere? I have had a look but couldn't find anything.

Has anyone any idea please?

Thanks.

wywywywy avatar Jan 13 '19 10:01 wywywywy

too many new() in AHKhttp.ahk.

forbbs avatar May 21 '19 14:05 forbbs

I have the same problem. My script crashes after 1270 - 1290 requests. And I'm not smart enough to solve this, so please help.... ;-(

Kindly Aki

Akibakki avatar Jun 01 '19 17:06 Akibakki

Has anyone any idea please?

You could try downloading and running the initial commit version https://github.com/zhamlin/AHKhttp/tree/65de0446156ccc4b2a3ed15e7f39d325ba6850db

I believe that when support for binary files was added, a Stack Overflow error was introduced.

rtayne avatar Jun 02 '19 13:06 rtayne

Yes.... Thanks!!!

I got it working....

Thank you again rtayne

Akibakki avatar Jun 02 '19 20:06 Akibakki

Yeah, the new Buffer class is definitely where the issue is. I've run a few tests and it always fails between 1,000 and 2,000 requests. I end up getting a "Function recursion limit exceeded" error at line 354 (attached). I'll dig into this myself, but this is a bit beyond my current level in AHK. Any ideas on how to deal with this? Reverting back to the initial commit seems to cause other issues. Screenshot 2020-09-20 023140

CrashKoeck avatar Sep 20 '20 10:09 CrashKoeck

After hunting for a while, found this on the forums that patches the leak - https://www.autohotkey.com/boards/viewtopic.php?t=4890&start=40

In case something happens to the post, attached is the patched and zipped AHKhttp.ahk (full credit to magusneo. I'll put in a pull request with this, but seeing how there have been no responses for quite a while, the updated *.ahk is here.

Note: I've also updated it with the pull request by @bjc5233 to fix the linefeed and variable name bugs. I've also stress tested up to 10K calls and it seemed to be stable vs cashing after less than 2K calls.

AHKhttp.zip

CrashKoeck avatar Sep 25 '20 09:09 CrashKoeck

After hunting for a while, found this on the forums that patches the leak - https://www.autohotkey.com/boards/viewtopic.php?t=4890&start=40

In case something happens to the post, attached is the patched and zipped AHKhttp.ahk (full credit to magusneo. I'll put in a pull request with this, but seeing how there have been no responses for quite a while, the updated *.ahk is here.

Note: I've also updated it with the pull request by @bjc5233 to fix the linefeed and variable name bugs. I've also stress tested up to 10K calls and it seemed to be stable vs cashing after less than 2K calls.

AHKhttp.zip

At the post, you said it didnt worked afterall? https://www.autohotkey.com/boards/viewtopic.php?p=410391#p410391

xinxilas avatar Jul 26 '21 17:07 xinxilas