Jump to content
Sign in to follow this  
Fluit

Maximum variable size

Recommended Posts

A script I'm writing is using a very large multidimensional array.

I have not experienced any problems yet, but I am worried that the size of the array can get so big it will break the mission.

I read in this thread that the memory allocation in OFP was limited to 256 MB.

Is this still the same in Arma 3?

Share this post


Link to post
Share on other sites
A script I'm writing is using a very large multidimensional array.

I have not experienced any problems yet, but I am worried that the size of the array can get so big it will break the mission.

I read in this thread that the memory allocation in OFP was limited to 256 MB.

Is this still the same in Arma 3?

do you know how big you array will need to be to fill that much RAM?

that amount has probably atsronomically increased since OFP, prehaps somebody who knows about memory allocators and arma can come in and answer more precisely

It is an extreme impossibility to get any decent PC to run out of RAM using variables with arma, that being said its possible if you try.

Filling up an array with like 46 thousand garbage variables could probably do the job if every var is roughly 32 characters in length.

EDIT: Would appear from testing it takes thousands of elements just to fill 1 megabyte, thats with one CPU core floating around 90 percent utilization and the RAM arma is using increases at about 1 megabyte/2 seconds. The loop had a sleep time of 0.00001;

Edited by austin_medic

Share this post


Link to post
Share on other sites

Well, the only answer is to test it. Here you go:

0 = [] spawn {
testArr = [];
_count = 1;
while {true} do {
	testArr pushBack [player,player,player,player,player];
	systemChat format ["%1",count testArr];
	_bad = false;
	{
		if (not (_x isEqualTo [player,player,player,player,player])) then {
			_bad = true;
			diag_log format ["ELEMENT CORRUPTED %1",_x];
			diag_log format ["ELEMENT %1 CORRUPTED",_forEachIndex];
		};
	} forEach testArr;
	if (_bad) then {
		diag_log format ["COUNT ARRAY WHEN ELEMENTS START TO GO WRONG %1",count testArr];
	};
	if (count testArr != _count) then {
		diag_log format ["COUNT %1",_count];
		diag_log format ["COUNT ARRAY %1",count testArr];
		diag_log "ARRAY IS DIFFERENT TO WHAT WE EXPECT";
	};
	sleep 0.001;
	_count  = _count + 1;
};
};

Put that in your debug console, then you will know the answer. I got to an array size of 3448 (no errors) before I got bored.

Share this post


Link to post
Share on other sites

Run this

arr = []; arr pushback arr

it will error but tell you max elements array expected

Share this post


Link to post
Share on other sites

I get that:

13:04:41 Recursive array
13:04:41 Error in expression <arr = []; arr pushback arr>
13:04:41   Error position: <pushback arr>
13:04:41   Error 20768604 elements provided, 22089652 expected

Share this post


Link to post
Share on other sites
I get that:

13:04:41 Recursive array
13:04:41 Error in expression <arr = []; arr pushback arr>
13:04:41   Error position: <pushback arr>
13:04:41   Error 20768604 elements provided, 22089652 expected

I get

Error 37239076 elements provided, 38565364 expected

I have 8GB RAM what you have?

Share this post


Link to post
Share on other sites

hi

without maxMem startup parametr game uses 512-1536 MB of memory..

u can specify maxMem and use the max value which is 2047..

it cant use more.. so it doesnt matter if u have 6 or 8 GB available..

check this wiki page: community.bistudio.com/wiki/Arma_3_Startup_Parameters

(sorry i cant post links since im new here..)

Share this post


Link to post
Share on other sites
hi

without maxMem startup parametr game uses 512-1536 MB of memory..

u can specify maxMem and use the max value which is 2047..

it cant use more.. so it doesnt matter if u have 6 or 8 GB available..

check this wiki page: community.bistudio.com/wiki/Arma_3_Startup_Parameters

(sorry i cant post links since im new here..)

So why my result and Das Attorney's are different?

Share this post


Link to post
Share on other sites
hi

without maxMem startup parametr game uses 512-1536 MB of memory..

u can specify maxMem and use the max value which is 2047..

it cant use more.. so it doesnt matter if u have 6 or 8 GB available..

I believe that maxMem allocates RAM for just supporting the engine, all other processes are handled outside of that threshold (but I'm just assuming based on the wording of the page you linked).

Share this post


Link to post
Share on other sites
I believe that maxMem allocates RAM for just supporting the engine, all other processes are handled outside of that threshold (but I'm just assuming based on the wording of the page you linked).

It does. I just tested for about 30 minutes and the game was able to use well over 2 gigs of RAM.

I get a feeling the guy a few posts up is new and doesn't have a super deep understanding of scripting and how it works, but thats fine, still a relevent question.

Share this post


Link to post
Share on other sites
I get a feeling the guy a few posts up is new and doesn't have a super deep understanding of scripting and how it works, but thats fine, still a relevent question.

Well, I'm just happy I was right (in part), cause I was actually just guessing, based on the results of KK and Das's tests, I guess you can learn something after 1600 some odd posts :p.

Edited by JShock

Share this post


Link to post
Share on other sites
It does. I just tested for about 30 minutes and the game was able to use well over 2 gigs of RAM.

I get a feeling the guy a few posts up is new and doesn't have a super deep understanding of scripting and how it works, but thats fine, still a relevent question.

How did u test it ?

I will leave the rest without any comments...

Anyway.. I have 8GB RAM and this is what i got..

1) startup parametrs -cpuCount=2 = Error 21948252 elements provided, 23269300 expected

2) startup parametrs -cpuCount=4 -exThreads=7 -maxMem=2047 = Error 39053148 elements provided, 40374196 expected

In both cases RAM usage didnt exceed 1.2GB..

So lets say this isnt correct way how to test that...

Share this post


Link to post
Share on other sites

Play or make a test mission with lots of spawning and despawning objects&units (like EOS or something with a unit cache system) You exceed 2 gigs easy over time.

Share this post


Link to post
Share on other sites
Run this

arr = []; arr pushback arr

it will error but tell you max elements array expected

This is the result

Error 27256668 elements provided, 28577716 expected

I tried adding huge amounts of data to an array, but couldn't break it, so that's good news.

The bigger the array the slower the script was running though.

Still don't know the actual size (in bytes) an array can be but that's all right.

Share this post


Link to post
Share on other sites
This is the result

Error 27256668 elements provided, 28577716 expected

I tried adding huge amounts of data to an array, but couldn't break it, so that's good news.

The bigger the array the slower the script was running though.

Still don't know the actual size (in bytes) an array can be but that's all right.

I'd assume thats because the array eventually gets so massive it takes a long time to write it into/out of the RAM (> a few miliseconds, any large delay of even a few ms is critical to if there will be stuttering, and the script can only run for 3ms before it halts until the next frame begins so it can continue).

That being said depending on what your doing you could break the one big array into smaller arrays that will be loaded into RAM faster with less of a delay, preventing stuttering.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×