| 10-14-2005, 09:20 PM | #1 |
Ok, I understand the whole Memory Leak thing, its not about that. What I am asking is that setting a point and a unit group should you use 2 variables? Example: With 2 Set TempPoint: Position of Casting Unit Set TempUnitGroup: All units within 700 of TempPoint With 1 Set TempUnitGroup: All units within 700 of postion of casting unit. |
| 10-14-2005, 10:04 PM | #2 |
Hmm, I don't really know the answer to that. Probably vex will be able to answer that. He's got more info on the behind-the-scense of warcraft. It depends what's creating the memory leaks. If it's warcraft leaves memory un-handled when it calls upon a custom class, as in the case of (Center of Region) then you would want 2 variables. But if the case is that Warcraft derives the center of the region each time from the region, and leaves it's extra variables behind then you would want 1 variable, since the unit's position is saved directly to memory and wouldn't have to be derived. One thing you do know though is it won't leak if you use 2. It still might not leak with 1, but 2 will always be safe. |
| 10-15-2005, 12:20 AM | #3 |
u should use 2 variables here, since position of casting unit creates a location. |
| 10-15-2005, 03:23 PM | #4 | |
Quote:
All Handles leak if not destroyed, if I'm not mistaken. To clean up the TempPoint, call this at the end of the function: JASS:call RemoveLocation(TempPoint) Assuming that the unitgroup is meant to be temporary, you should do the same to that as well: JASS:call DestroyGroup(TempUnitGroup) You were 100% correct in storing both the location and group to variables. |
| 10-15-2005, 03:43 PM | #5 |
Well not exactly all handles, only those that are instanced in game. handles like player or effecttype for example, are never created in game, they are already there, always there and they are always the same you don't have to destroy them. But things that you create, like units, effects, points, groups have to be destroyed. And as everybody said you have to save and destroy both the point and the group |
| 10-16-2005, 12:54 AM | #6 |
Just on a note, why is it called Remove location rather than Destroy Location? |
| 10-16-2005, 06:20 AM | #7 | |
Quote:
because the origional location stays intact, while the referance to it is removed. That, or the blizzard dev's do wierd things :) (wispSplode.mdl...) |
| 10-16-2005, 07:38 PM | #8 |
Wrong, RemoveLocation() destroys the location the same way DestroyGroup() destroys a group. The difference in the name is lost on me as well. |
| 10-17-2005, 12:43 PM | #9 |
For me both Remove and Destroy are the same thing. a location is not a point it is a class with 2 real attributes, let's imagine blizzard's ways of programming: Code:
class location
{
Private:
real x
real y
Public:
location(real ix, real iy);
~location();
Move(real nx, real ny);
...
}Some |
