array limits

Blitz3D Forums/Blitz3D Beginners Area/array limits

Paulo(Posted 2004) [#1]
Can anyone please tell me what a dangerous or unpractical amount of single arrays to use in one program would be with say using say Dim myarray(1000)? Im currently using 14 and have no problems at all, but I just wondered if and when this might become a problem. Any help would be appreciated. Thanks.


soja(Posted 2004) [#2]
You know it's unpractical when your performance starts going out the window.

First of all, it depends on what your array type is. If it's an array of types, then you might take up a whole lot more memory than just an array of ints (if your custom type is large). Assuming it's an array of ints, you can figure out approximately how much memory (in bytes) it will take up by multiplying it by 4. For example, an array of 1000 integers will take up 4000 bytes which is approximately 4 KB...which hardly matters on today's machines.

An array of 1 million integers, in fact, is "only" about 3.8 MB.

It might become a problem if you have to search through every one during each frame of your game, and it starts slowing your program down too much. Or perhaps it just takes up too much memory and hogging virtual RAM.

It depends on your target platform too. If you want to run on 486 machines, you're going to have to pay much more attention to stuff like this.


Paulo(Posted 2004) [#3]
Okay thanks again Soja! :) Right I appreciate its relevent to machine spec and so forth, from what you say I think I should be well in the safety limits for now.

Paulo