HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Location Leak Question

03-16-2007, 04:00 AM#1
Hydrolisk
I've seen clean-ups for locations and so far, all of them seem to not have anything such as "destroy region" where "region" would be something like "300 units away from unit". Would you have to clean that up?

And also, if I made a trigger such as (or something like this):
[trigger]Actions: WHATEVER
Conditions: WHATEVER
Actions: Unit - Move UNITWHATEVER WHATEVER units DIRECTIONWHATEVER[trigger]
then would it make a lot of memory leaks because I didn't set the WHATEVER location to a variable and cleaned it?
_____________________________________________________________________________________

BONUS QUESTION

What's the difference between NULLING and DESTROYING a memory leak/variable?
03-16-2007, 04:12 AM#2
Ammorth
I can answer the bonus question!

Nulling sets the variable to null (doesn't reference any memory) where Destroying destroys the handle the variable references.

I don't understand the first question so well.

The second question will create a lot of points, but you just have to set the starting point (position of unit) and the polar offset to different variables and then destroy them both to avoid memory leaks.
03-16-2007, 05:14 AM#3
Jazradel
Yes, you have to destroy regions as well as locations.
03-17-2007, 12:12 AM#4
Hydrolisk
Regions too?
What about preplaced regions? Geez, that is retarded! Does "Center of Region" leak also? Wow that's kinda dumb.

So, for nulling and destroying, I can still use the local/global variable right after I set them again?
03-17-2007, 12:53 AM#5
Earth-Fury
A handle is a pointer to a more complex structure of data. much like an index in an array. The number of an index means nothing, its just a number. But the value of the variable held at that index means allot.

So when you create an object thats a subtype of handle, you create the data, and a pointer to it. You can have 3 variables all pointing at the same unit, and when one of those variables goes away, (eg: the function they are in returns) the unit still exists. It hasnt gone anywhere. It still takes space up on the map. This is a great analouge to how every handle-type takes up space in memory after the variables themselves are gone. You have to explicitly destroy them (kill the unit) to free the space.

If you have something like a region thats used for the whole duration of the maps run, of course you don't destroy it. because you still need it. You don't kill units at the end of every function that manipulated them, now do you?

What a memory leak is, is simply a bunch of un-needed stuff thats serves no purpose taking up space in memory. For example, if you create a location, use it once, then never ever use it again, its a memory leak. This is why you destroy stuff.

I keep postign complex stuff when im really sleepy... Who votes i should sleep more often?

Edit:

Quote:
Originally Posted by Hydrolisk
Does "Center of Region" leak also?

It creates a location, so yes.
03-18-2007, 01:50 AM#6
Hydrolisk
Does that mean there is no way of using regions without having to create variables and destroying/nulling them? ... Gay.
03-18-2007, 09:27 AM#7
Guest
I was going to create my own thread like this one, but I'll just post in here to save space.

If I'm using a local location, do I have to destroy and then null it or is doing one or the other fine?
03-18-2007, 11:55 AM#8
Thunder_Eye
you could use the regions coordinates
03-18-2007, 06:20 PM#9
FatalError
Quote:
Originally Posted by Thunder_Eye
you could use the regions coordinates
Yeah but he's a GUI person (I'm assuming), and it's much easier to do the nulling/destroying than to work with coordinates in GUI.

Quote:
Geez, that is retarded!
Yeah, it is. Go blame Blizzard, they're the ones that fucked up JASS completely.
03-20-2007, 07:32 PM#10
Hydrolisk
Quote:
Originally Posted by FatalError
Yeah, it is. Go blame Blizzard, they're the ones that fucked up JASS completely.

You do mean GUI right?
03-20-2007, 07:42 PM#11
Thunder_Eye
Quote:
Originally Posted by FatalError
Yeah but he's a GUI person (I'm assuming), and it's much easier to do the nulling/destroying than to work with coordinates in GUI.

I only answered his question, didnt say it was better
03-20-2007, 08:50 PM#12
Earth-Fury
Quote:
Originally Posted by Hydrolisk
You do mean GUI right?

JASS is a really fucked up language in many ways. GUI inherits these flaws, as GUI is a point-and-click interface for writing JASS code. (which, in itself, they did a pretty damn good job on.) I wouldn't say its fucked up COMPLETELY.
03-21-2007, 11:11 AM#13
Toadcop
use 1 or several global locations for all what you need ! and simple move it !