• 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.

[Spell] Conflicting info on destructible leak

Level 23
Joined
Dec 4, 2007
Messages
1,559
Basically i'm wondering if Maker's comment is true or not:

I dug up some more threads and it seems folks ignore the leak, or perhaps it's not even leaking?
 

deepstrasz

Map Reviewer
Level 75
Joined
Jun 4, 2009
Messages
20,249
On second thought. I guess you could do a loop or use more of those picks and make them repeat periodically. See if the map starts lagging after a certain time.

If not, maybe you could tweak something with this
  • Set VariableSet DestructPos = (Position of (Last created destructible))
  • Set VariableSet DestructRegRange = (DestructPost) offset by 256.00 towards 0.00 degrees.)
  • Destructible - Pick every destructible in (Region centered at DestructRegRange with size (0.00, 0.00)) and do (Actions)
    • Loop - Actions
Or maybe there's a Jass way of setting the region that way to include both the range and position like you can with unit groups.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
I'd just ignore the leak (if one even exists), it's possible it was fixed over the years. I've always been using "Pick every dest within range of point" and never noticed any issues. Pretty sure a lot of systems that are commonly used have been using it all this time as well, so again, doesn't seem like much of an issue.

I'd add it to the "double check this once the game is 100% finished" list.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
What Maker said is correct; it is a reference leak, not an object leak. The temporary rect is destroyed but the variable is not nulled, so this is effectively the same as the 'locally declared handle leak on return' issue that many GUI functions suffer from. This function is no worse than any of those, though if you really care you can change your map script mode to Lua to sidestep the issue entirely. (That has other implications, though.)
JASS:
function EnumDestructablesInCircleBJ takes real radius, location loc, code actionFunc returns nothing
    local rect r

    if (radius >= 0) then
        set bj_enumDestructableCenter = loc
        set bj_enumDestructableRadius = radius
        set r = GetRectFromCircleBJ(loc, radius)
        call EnumDestructablesInRect(r, filterEnumDestructablesInCircleBJ, actionFunc)
        call RemoveRect(r)
    endif
endfunction
I suppose set bj_wantdestroygroup doesn't work for destructibles because that would have been too convenient for Worldedit :xxd:
Of course not. There's no such type as a destructable group.
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
I'd just ignore the leak (if one even exists), it's possible it was fixed over the years. I've always been using "Pick every dest within range of point" and never noticed any issues. Pretty sure a lot of systems that are commonly used have been using it all this time as well, so again, doesn't seem like much of an issue.

I'd add it to the "double check this once the game is 100% finished" list.
my memory fails me, I want to remember there was a leak but there was additional context required which I have forgotten.
Regardless, leaks is near irrelevant depending on where it's placed. If it's on map startup a few leaks makes no difference. It's when they are looping they start to become real scary.
 
Top