Page 1 of 1

How do I set memory limits?

Posted: 25 Feb 2018, 15:19
by arcticir
The following code, if there is only one thread (DLL), is normal to load.
However, if you use two threads , it will complain.

Error: Out of memory.

Code: Select all

f:=[]
MsgBox f.SetCapacity("cache",388*1024*1024)
How do I adjust the inner limit to 2G?

Re: How do I set memory limits?

Posted: 25 Feb 2018, 19:49
by HotKeyIt
Works fine for me:

Code: Select all

a:=ahkThread("f:=[]`nMsgBox f.SetCapacity('cache',388*1024*1024)")
b:=ahkThread("f:=[]`nMsgBox f.SetCapacity('cache',388*1024*1024)")
f:=[]
MsgBox f.SetCapacity("cache",388*1024*1024)

Re: How do I set memory limits?

Posted: 25 Feb 2018, 23:44
by arcticir
Try It

Code: Select all

a:=ahkThread("f:=[]`nMsgBox f.SetCapacity('cache',388*1024*1024)")
b:=ahkThread("f:=[]`nMsgBox f.SetCapacity('cache',388*1024*1024)")
MsgBox a:=ahkThread("f:=[]`nMsgBox f.SetCapacity('cache',388*1024*1024)")
MsgBox a:=ahkThread("f:=[]`nMsgBox f.SetCapacity('cache',388*1024*1024)")

f:=[]
MsgBox f.SetCapacity("cache",388*1024*1024)

Re: How do I set memory limits?

Posted: 26 Feb 2018, 17:52
by HotKeyIt
You simply hit the memory limit, same happens in AHK_L:

Code: Select all

f:=[]
Loop 5
MsgBox f.SetCapacity("cache" A_Index,388*1024*1024)

Re: How do I set memory limits?

Posted: 28 Feb 2018, 01:26
by arcticir
So this is normal? Or a bug?

Re: How do I set memory limits?

Posted: 28 Feb 2018, 03:39
by Helgef
How do I adjust the inner limit to 2G?
It is not the inner limit which you are exceeding (there is none), it is your system's / PC's limit. There is no limit for object's fields in v1 either, but there we have #MaxMem for variables. So to answer the thread title, buy more memory for your PC ;). You could also free up more memory by closing memory heavy application, if any such are running.

Cheers.

Re: How do I set memory limits?

Posted: 28 Feb 2018, 04:13
by arcticir
I can't agree with you.
My memory usage is 2/16G, how much memory do I need to add to not make mistakes?

Re: How do I set memory limits?

Posted: 28 Feb 2018, 04:23
by Helgef
I cannot answer that. There could be system factors on memory handling, I have no idea. I get out of memory on loop 33, I have only 8 gb ram, but loop 33 implies some 12 gb allocation, apparently my system is ok with that.

Re: How do I set memory limits?

Posted: 28 Feb 2018, 17:53
by HotKeyIt
Simply use 64-bit version and you can use all your memory :)

Re: How do I set memory limits?

Posted: 01 Mar 2018, 02:41
by Helgef
Wow, that makes a big difference, I didn't know. Thanks for pointing that out HotKeyIt :wave:

Cheers.

Re: How do I set memory limits?

Posted: 01 Mar 2018, 05:09
by arcticir
So, when I use 64-bit system, there is enough memory, it is still wrong, because of what?

Re: How do I set memory limits?

Posted: 01 Mar 2018, 12:02
by guest3456
i think HotKeyIt is saying to use x64 version of AHK-H