• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ HD Level Design Contest #1 POLL is now OPEN! Check out the stunning visuals of the final entries. 🔗Click here to cast your vote!

how much does point(location?) leak, in memory ?

Status
Not open for further replies.
Level 26
Joined
Aug 18, 2009
Messages
4,097
A mere 5000 locations shall influence the gameplay? A little test gave me about 256 bytes per location, which seems already very much considering next to framework it only needs to store x and y coordinate. 256*5000/1024/1024~1,22mb. Locations do no stuff besides taking some space, so only allocation/deallocation and using them in triggers requires some active processing.
 
Level 4
Joined
Apr 15, 2011
Messages
108
Are you referring to the "value" that can decrease the performance ?
there was actual list somewhere, like each player in player group adds 10 kb of more memory usage etc.

5000 location = massive lag sounds ridiculous, I have a map with approx 2000~ center of region codes and it has no lag, no problem, on a normal computer.

A mere 5000 locations shall influence the gameplay? A little test gave me about 256 bytes per location, which seems already very much considering next to framework it only needs to store x and y coordinate. 256*5000/1024/1024~1,22mb. Locations do no stuff besides taking some space, so only allocation/deallocation and using them in triggers requires some active processing.

I want to believe this.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Infact, keeping some thousand handles statically alive to continue working with them is not that unusual. Well, I guess you are a GUI user, else you will hardly need locations. Avoiding/destroying leaks in GUI is kind of a hassle to implement custom scripts and shift parameters. So would only suggest to get rid of the big fishes --> frequent triggers that create massive amounts.
 
Level 14
Joined
Aug 8, 2010
Messages
1,021
I have played a map that probably had leaks and after the 20-th minute i slowly begin to be unable to move my mouse and have uber big lag.. and at the 30-th minute i have to close the game because my PC is going to explode (my PC is with super good performance...)

So thats what leaks probably do...
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
GUI users often do low periodic events and pick units around a location, not destroying the spots nor the groups. So just 2 handle leaks every 0.1 seconds for 20 min --> 20*60*10*2, that's already 24k, now they allocate more locations inside like with polar projection, have multiple picks or triggers doing this. Ultimate MCA would be a double/multi-dimensional pick loop in low periodic. Well that easily can stuff the memory. But if you have rarely firing triggers or just once, it is not that wild.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,171
how much does point(location?) leak, in memory ?
None. Unlike units which leak a few KB each.

That is if you bother freeing the location once you are done with it. The native to do this is RemoveLocation(locationvalue).

Obviously if you fail to free the location before losing all pointers to it you will cause a memory leak.
 
Level 4
Joined
Apr 15, 2011
Messages
108
None. Unlike units which leak a few KB each.

That is if you bother freeing the location once you are done with it. The native to do this is RemoveLocation(locationvalue).

Obviously if you fail to free the location before losing all pointers to it you will cause a memory leak.
obviously I was asking how much if I dont bother removing them.
lets say I cause leak, how much ? I think few kb's as many says. Im ok with this.jpg
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,171
lets say I cause leak
Then your a bad programmer.

However, it is also probably a KB or less. as locations are simple objects.

The problem is not the quanity of memory locations leak, but the game complexity they leak. They leak handle identifiers and such with them which all means the game engine has to work harder to do other trigger opperaions.
 
Level 4
Joined
Apr 15, 2011
Messages
108
Then your a bad programmer.

However, it is also probably a KB or less. as locations are simple objects.

The problem is not the quanity of memory locations leak, but the game complexity they leak. They leak handle identifiers and such with them which all means the game engine has to work harder to do other trigger opperaions.
It is not about programming, writing one/two lines of code, its all about time. Finishing my product is important as much as programming.

But I dont want to fix for every "center of region" I use, I just dont have time or too lazy. they dont leak much after all, do they ?
 
Level 4
Joined
Apr 15, 2011
Messages
108
No one will play your map if that is the attitude you take to it.

You might wish to consider using JASS, it may be faster for stuff like this as it avoids the crappy GUI interface.
No one will ever play my map if I waste my time with leaks that only leak 1 kb I can never finish my map.

Im alredy using basic jass or normal gui but I was just wondering if I should fix "center of region" stuff, apparently, im not.
 
Level 8
Joined
Dec 9, 2009
Messages
397
If you only use the location for a second (no waits) you can use "TempLoc" variable for every single location in your game. so it's not like you have to make a variable every time.
and if you clean it up right when you make it in editor, it'll barley effect the time it takes to make a map....
 
Level 8
Joined
Apr 26, 2011
Messages
403
No one will play your map if that is the attitude you take to it.

You might wish to consider using JASS, it may be faster for stuff like this as it avoids the crappy GUI interface.

I don't agree with this.

Skibi's Castle - one of best warcraft 3 map. It is a really big map and written in GUI.

also some example in real life:

- for HTML, geek always say everyone should write in plain HTML with text editor.
- but in real life, you can't spent too much time on your project, and you must use dreamweaver/template do make the site quickly by drag/drop/copy/phase.

- for C#, geek always say everyone should code in text editor.
- but the fact is: programmer must use Visual Studio with special template/plugin to done their job quicky by drag/drop/copy/paste/import.

Time is costly for any real project, and you can't spent too much time on gold plating stuff.
 
Level 8
Joined
Dec 9, 2009
Messages
397
Any template or import you will find for warcraft, has the leaks cleaned up, and if your making something from scratch as most maps are done, cleaning the leaks is very easy and takes very little time.


If you want to see the effects of location leaks over time, play Custom Hero Line wars, and pick Natures Wrath from the first building on top.
It roots units around you, and over time the game will be unplayable.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Maybe for a game that doesn't require a lot of precision, and has around 20-40 mintues of gameplay, is OK... can be done the 'noob' way, like a TD, or Maul defense... But for an RPG of 4 or 5 hours of gameplay, or games like DotA that requires a lot of precision in terms of 'lag' and 'delay', taking care of leaks matters a lot.
 
Level 2
Joined
Jan 19, 2011
Messages
19
No one will ever play my map if I waste my time with leaks that only leak 1 kb I can never finish my map.

Removing a leak takes 2 seconds, so I dont see the problem really...

And if you have that attitude, why should you terrain? Just dirt ground and some forest that blocks the way and some houses goes way faster.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
@Nasin: Because it's very much noticeable?

In the old times, mapmakers did not know about the leaks and we still played a lot of maps. You have to see if it does matter and compare it to your goals.

To combine it with GUI everywhere I think that's doubtful as this lowers readability, throws in another language, most GUI users do not really know how it works, it's another chance to implement bugs. Just consecutively writing "set var = createObject; useObject(var); destroyObject(var)" is not always effectively either. After all, the deallocation of things requires some processing resources as well. And then you could easily question why to use GUI in general. What's with all those "Does this leak"-threads anyway?
 
Level 4
Joined
Apr 15, 2011
Messages
108
If you only use the location for a second (no waits) you can use "TempLoc" variable for every single location in your game. so it's not like you have to make a variable every time.
and if you clean it up right when you make it in editor, it'll barley effect the time it takes to make a map....

Its like I said "blue" and you said "chair", what you say is totally unrelated. I know I need only one. so what ? it still takes time.
I don't agree with this.

Skibi's Castle - one of best warcraft 3 map. It is a really big map and written in GUI.

also some example in real life:

- for HTML, geek always say everyone should write in plain HTML with text editor.
- but in real life, you can't spent too much time on your project, and you must use dreamweaver/template do make the site quickly by drag/drop/copy/phase.

- for C#, geek always say everyone should code in text editor.
- but the fact is: programmer must use Visual Studio with special template/plugin to done their job quicky by drag/drop/copy/paste/import.

Time is costly for any real project, and you can't spent too much time on gold plating stuff.
you can code html in notepad html isnt something really serious. but whoever says c# should be coded in notepad is plain stupid.
Any template or import you will find for warcraft, has the leaks cleaned up, and if your making something from scratch as most maps are done, cleaning the leaks is very easy and takes very little time.


If you want to see the effects of location leaks over time, play Custom Hero Line wars, and pick Natures Wrath from the first building on top.
It roots units around you, and over time the game will be unplayable.
It is because custom hero line wars is pure stupid. Im not talking about leaks like "hurr durr I create a loc every second and dont remove them" Im talking about leaks like "oh, I made a mistake but this isnt spell stuff or anything, maybe I should just leave them like this ?"

Removing a leak takes 2 seconds, so I dont see the problem really...

And if you have that attitude, why should you terrain? Just dirt ground and some forest that blocks the way and some houses goes way faster.

Because people see terrain, but they probably dont even notice leaks if they arent much.
does it matter how much kb each points leaks?
the important thing is that it leaks and you should clear leaks...

Yes it does, I will leave them as they are if they dont much.
 
Level 9
Joined
Jun 25, 2009
Messages
427
No one will ever play my map if I waste my time with leaks that only leak 1 kb I can never finish my map.

Im alredy using basic jass or normal gui but I was just wondering if I should fix "center of region" stuff, apparently, im not.

It's not me to get into arguing so fast but I feel that I should give you my advice as I have been thinking mostly about the same as you are now.

I was creating my map for about 1-2 months (I hope I'm not lying, can't remember actually :() when suddenly I found out a thing like leaks. Wow.
My friend gave me a link to a tutorial and suggested me I removed the leaks. I thought - after working so hard and for such a long time, going through every trigger and clearing leaks would be killing my time.

No, it didn't. It took me about 30mins-2hrs (can't remember) but the leaks were gone and the map started to work better after this.

Suggestion: Just do it! ;)

Tiche3
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,171
The problem is not the memory that the locations leak, it is the other assets in the engine that go with it. The result is that handle orientated opperations start to take more time.

WC3 will easilly become unplayable or even crash all together due to leaks long before it runs out of virtual memory.

I am not saying that GUI style progaming in general sucks, just WC3's GUI sucks. The GUI SC2 uses does not not suck for example.

Problems with WC3 GUI.
1. Missing features (like locals, many natives and code patterns). Infact this list is huge that JASS can do that GUI can not.
2. Leaks (some of the actions reference script implimentations that leak such as PolledWait).
3. Bloated code, including referencincing wrapper functions unnescescarilly and creating functions for no reason (could be inlined).
4. Crash prone when some actions are selected.

Problems with SC2 GUI.
1. Unable to dynamiclly create triggers (which is virtually never needed).
2. Code is slightly bloated due to GUI template structures (but nowhere near as much as in WC3).

As you can see, WC3 GUI is just plain BAD.
 
Level 14
Joined
Aug 8, 2010
Messages
1,021
RLstorm, the size of the leaks does not matter... if you have around 30,000 leaks your map will not be playable because of the gigantic lag... just avoid leaks. Or if you have some leaks - then they must be few...

I can't get it... is it that hard to type 'call RemoveLocation(udg_locationName)'?
 
Level 19
Joined
Jul 12, 2010
Messages
1,713
RLstorm, the size of the leaks does not matter... if you have around 30,000 leaks your map will not be playable because of the gigantic lag... just avoid leaks. Or if you have some leaks - then they must be few...

I can't get it... is it that hard to type 'call RemoveLocation(udg_locationName)'?

nope, it's pretty easy but idk why ppl are too lazy to even do that o_O
 
Level 23
Joined
Jan 1, 2011
Messages
1,488
http://www.hiveworkshop.com/forums/pastebin_data/4yk2iv/_files/Leaker.w3x
I've made an example map of how locations do cause unbearable lag
Leaks.jpg

My location leak limit is 740,000 which is a lot more then i expected. Still, you will see that the lag gradually gets worse and worse.

All leaks of any kind, will build up. So it is a MUST to remove them.

In the end when you realize that your map ain't gunna be worth shit because no one wants to Alt-F4 mid game because of lag. And I will laugh, and so will many others.
 
Level 4
Joined
Sep 22, 2011
Messages
70
5000 location = massive lag sounds ridiculous, I have a map with approx 2000~ center of region codes and it has no lag, no problem, on a normal computer.

Keep in mind tho, the leak only occures once the trigger is RUN, not just at the start of the map. Each time the trigger is run, the "location" variable the game makes is stored, when the trigger is run again the variable is stored a second time, keeping the first stored variable there in memory. The leak would take time to build up to the point of major lag..

If you had a test trigger that whenever u type -test it ran every single action in your map that had a (Center of region) code, u would type it 3 times and then have to alt+F4 to get out of the game..
 
Level 8
Joined
Dec 9, 2009
Messages
397
The computer being used to play the map is really what matters,

crash.jpg


Not everyone has 8 gigs of ram though

A lot of people playing WC3 still have a comp with 512 - 1gig ram,
and cleaning them up is important.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,171
Not everyone has 8 gigs of ram though
A lot of people playing WC3 still have a comp with 512 - 1gig ram,
Sorry but you honestly have no idea about how RAM works...

WC3 is limited to atmost 4 GB of memory. This is because WC3 is a 32 bit program and thus is only given a 4 GB virtual memory address range. You could run it on a super computer with over 1 TB of RAM and it will still crash due to an out of memory error at 4 GB. Ofcourse the limit is less than 4GB infact due to some adress ranges being reserved.

Even people with only 512 MB of memory could still run out of virtual memory with the game reaching 4GB in size. Remember that your system memory is also backed with a page file on one of your disc drives (usually drive C or the main drive if you use OSX). Yes the page faults would probably make the game unplayable but you will not run out of memory for a long time.

The game will usually crash well before virtual memeory is a problem due to other reason (like finitly allocated resources running out).
 
Level 5
Joined
Aug 12, 2010
Messages
87
Hm this is cool i did experiment, set 10 000 point variables per second and after 10 second nothin... units move same no lagg but when i tryed to exit war3 i waited 10 sec to wc3 to close because probably memery needed to be reseted, wc3 used 160kb. Then i use custom script to remove location and after 10 secs wc3 used 120kb and no wait when i close wc3... So i can leak 1milion points before i feel lagg or remove leaks and i get 3 times more time before lagg lol.
 
Level 13
Joined
Sep 13, 2010
Messages
550
http://www.hiveworkshop.com/forums/pastebin_data/4yk2iv/_files/Leaker.w3x
I've made an example map of how locations do cause unbearable lag
Leaks.jpg

My location leak limit is 740,000 which is a lot more then i expected. Still, you will see that the lag gradually gets worse and worse.

All leaks of any kind, will build up. So it is a MUST to remove them.

In the end when you realize that your map ain't gunna be worth shit because no one wants to Alt-F4 mid game because of lag. And I will laugh, and so will many others.

Display text function cause heavy lag, especially when too much of them displayed at once. For me warcraft crashes at the point when RAM is out and it refuses to use Pagefile. 10000 location use 2000 Kbyte RAM for me. I was still able to play with 2 millions of uncleared locations without having problems.
 
Status
Not open for further replies.
Top