• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Q: Does this leak?

Status
Not open for further replies.
no, adding the unit to the unit group doesnt leak

be aware tho, that in Trigger 2 when you destroy Unit_group, you also destroy Unit_groupGrunts

Too confusing.
My main question is weather or not set unitgroup1=unitgroup2 is a leak maker for creating "mid air" unitgroup (set midair unitgroup = the 2 and this will go into unitgroup 1 ) In terms of swapping memory (I know that using set p = point, set R1=x of p, set R2 = y of p, create unit at (x,y) create a midair point and therefor leaks) I ask in terms of JASS, does this create 3rd , invisable unit group?

And not. I don't think this will remove the first group.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
Too confusing.
My main question is weather or not set unitgroup1=unitgroup2 is a leak maker for creating "mid air" unitgroup (set midair unitgroup = the 2 and this will go into unitgroup 1 ) In terms of swapping memory (I know that using set p = point, set R1=x of p, set R2 = y of p, create unit at (x,y) create a midair point and therefor leaks) I ask in terms of JASS, does this create 3rd , invisable unit group?

And not. I don't think this will remove the first group.

Maker, you and your nullying globals .. :D (no offence)

and because you dont think it will not destroy it doesnt mean it will not, test it and see that it will

thats because every non-native data type in Jass is a pointer to memory, so your unit group is actually 4 bytes pointer pointing to some data in the ram, and when you do group1 = group2, you say to group1 that it should point to the memory group1 is pointing, when you call DestroyGroup(group1), the memory that is being pointed to by group1 is cleared, meaning that memory that is being pointed to by group2 is wiped as well

but no it doesnt create leaks
You should rather do Copy group to group, or in GUI Pick every unit in Group ... and do: add Picked Unit to your group, this way, the group1 will not destroy group that is under group2

and I personally dont consider the 1 handle Id a leak, yes sure the counter must increase, but that surly wont allocate additional memory, just increase the handle Id stack
 
Yes it leaks since you don't null the destroyed group.

It is impossible to tell if the other group leaks based on the information you gave.
What will be a better way to set ug1=ug2, without creating a mid-air,3rd unitgroup?

And about the "it will remove both groups" NO ITS NOT.
I just tested.
Please don't write random things that are confusing.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
you must have done some shitty tests:
  • aaa
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Unit Group - Add Knight 0002 <gen> to var1
      • Unit Group - Add Footman 0001 <gen> to var1
      • Unit Group - Add Priest 0000 <gen> to var1
      • Set var2 = var1
      • Game - Display to (All players) the text: (Name of (Random unit from var1))
      • Custom script: call DestroyGroup(udg_var2)
      • Game - Display to (All players) the text: (Name of (Random unit from var1))
      • Game - Display to (All players) the text: aaaa
it prints: Knight(or Priest or Footman) and aaaa, not another name

so the unit group is destroyed even if I didnt touch it

you should do:
  • aaa
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Unit Group - Add Knight 0002 <gen> to var1
      • Unit Group - Add Footman 0001 <gen> to var1
      • Unit Group - Add Priest 0000 <gen> to var1
      • Unit Group - Pick every unit in var1 and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to var2
      • Unit Group - Pick every unit in var1 and do (Actions)
        • Loop - Actions
          • -------- do stuff with the group here --------
      • Unit Group - Remove all units from var2
this is more efficient then destroying and recreating the group, becuase that operations are way too slow

and no this will not create any leaks
 
I don't get what the smiley is for since if you think there can be only one leak per global then you are wrong.
He was wrong about the unit group and have no idea what the question is about, just ignore him.

What will be a better way to set ug1=ug2, without creating a mid-air,3rd unitgroup?
What is the answer? you said it will create 3rd ug, how to fix?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
He was wrong about the unit group and have no idea what the question is about, just ignore him.
Hey, don't be rude!
He is correct, but I think you don't completely understand him.
With your method: if you destroy Group1, then Group2 does not work anymore (because it points to Group1, which has been destroyed).
What is the answer? you said it will create 3rd ug, how to fix?
1) He never said it would create a 3rd unit group.
2) He has already given you the answer... twice.
Here's the answer again:
Edo said:
Pick every unit in Group ... and do: add Picked Unit to your group

[...] (another post)

  • Unit Group - Pick every unit in Group1 and do (Actions)
    • Loop - Actions
      • Unit Group - Add (Picked unit) to Group2
(The actions in that trigger replace "Group1 = Group2")

Maker said:
I don't get what the smiley is for since if you think there can be only one leak per global then you are wrong.
This is just a guess, but I believe he's just saying that you always mention the nulling whenever leaks are mentioned.
Thing is: you're in your full right to do so, but it's a minor leak - hence the smiley (it's a joke).

Does it leaks?
Yes: you should null the variables.
 
Status
Not open for further replies.
Top