| 07-16-2009, 12:05 PM | #1 |
Hey mates! I was told by one of the staff members on Hive Workshop that Blade.dk's CopyGroup function leaks. I tried asking him what he meant by it, but I never recieved a reply. Here's the function JASS:
private function CopyGroup takes group g returns group
set bj_groupAddGroupDest = CreateGroup()
call ForGroup(g, function GroupAddGroupEnum)
return bj_groupAddGroupDest
endfunction
So... how much of this is true? |
| 07-16-2009, 12:47 PM | #2 |
It creates a group, which suggests that at some later time you will be destroying the group and using groups dynamically like that has been confirmed to leak. |
| 07-16-2009, 01:01 PM | #3 |
this dont leak. Anitarf using groups dynamically cause no leaks at all, same to timers and any other objects expect some buggy like sound, gamecache, multiboard, multiboarditem and few other that cannot be destroyed at all. no proof no trust. |
| 07-16-2009, 01:10 PM | #4 |
I though bj_groupAddGroupDest already was a group? And we're using the same global variable for it, so I wouldn't be creating many groups... |
| 07-16-2009, 01:14 PM | #5 | |
Quote:
One that should, if this is the only function using it, be destroyed else where. Really, with vJass, you shouldn't be using bj variables, but just put it in a library and use a private group variable. |
| 07-16-2009, 01:30 PM | #6 |
this global reused every time, no matter what is stored inside. if you using vjass you can declare other globals and it will work in same way. (waste of space and time, since there is no difference) |
| 07-16-2009, 06:09 PM | #7 |
It should be obvious that it doesn't inherently leak. It only leaks if you handle the returned group improperly or don't destroy the group assigned to the overwritten BJ global. |
| 07-16-2009, 06:30 PM | #8 |
This is just like the GetRandomPosition function Vex made. It returns a location. If it will leak or not, depends on how you use it: JASS:
//Function made by Vexorian, it selects a random region in a disk.
//All regions have the same chance of beeing choosen
private function GetRandomPointInDisk takes real centerx, real centery, real minradius, real maxradius returns location
local real d = SquareRoot(GetRandomReal(minradius * minradius, maxradius * maxradius))
local real a = GetRandomReal(0, 2 * bj_PI)
return Location(centerx + d * Cos(a), centery + d * Sin(a))
endfunction
The difference here is the use of a bj_ variable, but that isn't much of a problem. Looks like I was right again Cheezman xD FP 2, THW 0 =P Now you know why I always make my code related questions here - because there are people who actually know what they talk about. You may want to save this link in favourites so you can later throw it to the face of those newbs =P |
| 07-16-2009, 08:17 PM | #9 |
Yeah I noticed that most of the members of hive gives false information about Jass related stuff... That's probably because they don't know any better, but I must admit, they helped me alot in my GUI days. |
| 07-16-2009, 08:58 PM | #10 |
THW has all the GUI pros you can ever imagine, The reason for that is because THW is a good place for GUI spells, while this website literally destroys GUI spells because of their inefficiency. Another reason is the fact that newbs who usually try to submit poor resources are humiliated by some (many) members of this community and so they leave. Also, this community is built under the notion of criticism, if you can't take it, then this is not the place for you. Thanks to these reasons, most THW hate Wc3c and refer to it as an evil place. Those who are in an advanced level however, know and understand the value of constructive criticism and so they learn how to love wc3c. Also, being here will never be easy, you will eventually make enemies with some people, but it is always up to you to transform those relations into something better (remembers me Griffen, my dear Nemesis) - it is a heavy responsibility most people will avoid. All this to say - THW is goog for GUI, but if you want something more and if you want to evolve, there is no place like Wc3c. Now go forth Cheezman ! And spread the valuable knowledge you learned here in the face of those who oppose you ! THW will be yours to take xD |
| 07-16-2009, 09:12 PM | #11 |
God, stop spamming already. The question has been answered, locked. |
