HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Arrays n variables memory usage

07-14-2004, 12:04 PM#1
sATARa
Im opsessed with memory usage :> so what i would like to know is when you make an array of rect for an example... is that array treated as an completely new array of rects, or just an array of pointers to rects, in the memory?
07-15-2004, 10:30 AM#2
sATARa
Anyone know?

p.s. How the hell do i get the look of this page back to normal? Its all white n pink...
it says inverted lol
07-15-2004, 11:06 AM#3
AIAndy
All non primitive data types are handles (pointers). Also arrays in Warcraft are dynamic, so they only use up the index range actually used.
But if you set the array to a certain size in WE then WE will generate code that actually fills that size with objects. If you don't want that set the size to the minimum and create objects in there manually.
07-15-2004, 11:29 AM#4
sATARa
Quote:
Originally Posted by AIAndy
All non primitive data types are handles (pointers). Also arrays in Warcraft are dynamic, so they only use up the index range actually used.
But if you set the array to a certain size in WE then WE will generate code that actually fills that size with objects. If you don't want that set the size to the minimum and create objects in there manually.

And I do that... how?
07-16-2004, 01:56 AM#5
AIAndy
There are create natives, but for most data types that is only available in JASS,
07-16-2004, 01:34 PM#6
Cubasis
If you really are obsessed with Memory and it's Usage. I'd just reccomend you to study about Memory leaks, as they can ruin your map memory-wise much more than 1000 units spawning around or sumtin.

Read my article in the tutorial section about it.

~Cubasis
07-16-2004, 05:29 PM#7
sATARa
Thx guys,
This is a bit over my head, since my JASS knowlage is very limited (to put it lightly)heh
I actually read that article a while back... good job on that one ,
but leaks are not really something i think i should worry about. Your tutorial gave me quite a scare hehe, so i was quite carfull with my triggers.
Anyway I still have a few questions, so i guess i can fit em here instead of opening a new topic...
I was meaning to ask how big are rects as variables, in memory i mean. They shouldnt be too big i figure, since they are basicaly defined by 4 real values and maybe a string for a name, right?
Thats my first question... The second one is, is there a way to make a "while"
function in the GUI. I know how to do it in jass, but the trigger i need it for looks scary in jass lol. Its like 3 screens long, and thats really not something i can handle.
07-16-2004, 05:56 PM#8
Cubasis
Well,

if you aren't worrying about leaks, you're not really worrying about memory either. But yeah, as long as you clean out every point and group and stuff that you create (if you understood it propperly), you're safe.

All the objects in WC3 seem to be wierdly large memory-wise, as leaking simple locations seems to grow WC3's memory usage really quickly. I tested this once, and I don't really remember the exact results, but leaking like 500000 locations raised it's memory usage of about 30 megs. That's 60 bytes per location, which is crazy as a location should only abe 2 reals (X,Y). And it could be even more, as at the time I only had 256 megs RAM, so it's likely that it started to resolve to pagefile in the progress.

But memory usage of active (as in... non-temporary, things you are using that shouldn't be destroyed/removed) objects should not really become a concern as these days, there is just so much of RAM available. I doubt you have 500.000 active locations in usage, or even 1000, or groups. And while rects are commonly used in high numbers, you shouldn't notice much performance difference untill you go into the tenths of thousunds. And then you should rather worry about the locations you create in getting the Center of them all, and EntersRect events you create for them.

~Cubasis
07-16-2004, 09:48 PM#9
sATARa
Well didnt say im not worrying about them, its just that i think i got them under control... at least enough for my taste.
I mean as far as i know, where ever i picked units or created them at ponints and so on... i used variables to store em and later delete em... bla bla

Im glad that you think that rects dont take up too much memory, cause i really plan to have lot of em heh
Anyway, thx I really appreciate your help... and oh yeah, do you know how i can pull this "while" thing using gui. Is it even possible?
07-16-2004, 11:36 PM#10
AIAndy
There are only dirty tricks to do that. You can set up a loop that runs from 1 to 3 and at the beginning of that loop put your if with the while condition. On true do set the loop variable to 1 and do your loop stuff. On false set the loop variable to 3 (might also be 2, just try it out).