How do I set memory limits?

Ask for help, how to use AHK_H, etc.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

How do I set memory limits?

25 Feb 2018, 15:19

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?
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How do I set memory limits?

25 Feb 2018, 19:49

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)
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: How do I set memory limits?

25 Feb 2018, 23:44

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)
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How do I set memory limits?

26 Feb 2018, 17:52

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)
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: How do I set memory limits?

28 Feb 2018, 01:26

So this is normal? Or a bug?
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: How do I set memory limits?

28 Feb 2018, 03:39

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.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: How do I set memory limits?

28 Feb 2018, 04:13

I can't agree with you.
My memory usage is 2/16G, how much memory do I need to add to not make mistakes?
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: How do I set memory limits?

28 Feb 2018, 04:23

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.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How do I set memory limits?

28 Feb 2018, 17:53

Simply use 64-bit version and you can use all your memory :)
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: How do I set memory limits?

01 Mar 2018, 02:41

Wow, that makes a big difference, I didn't know. Thanks for pointing that out HotKeyIt :wave:

Cheers.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: How do I set memory limits?

01 Mar 2018, 05:09

So, when I use 64-bit system, there is enough memory, it is still wrong, because of what?
guest3456
Posts: 3453
Joined: 09 Oct 2013, 10:31

Re: How do I set memory limits?

01 Mar 2018, 12:02

i think HotKeyIt is saying to use x64 version of AHK-H


Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 21 guests