• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Does chaos ability cause perma unit mem leak?

Status
Not open for further replies.
Level 31
Joined
Jul 10, 2007
Messages
6,306
I know that when a unit is created, even when it is removed it will have permanent memory in wc3 that is not cleared out until wc3 is restarted. I was wondering if applying chaos caused the same memory increase as

1. Create unit of type x
2. Remove created unit
3. Create unit of type y

I don't really want to run a memory test, so if anyone knows the answer to this or could run an infinite timed loop for like 10 hours and watch the memory, that'd be helpful : D.
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
Don't do this. It creates massive lag and still leaks.

Compare this to the version where you just replace the whole

JASS:
            if GetUnitTypeId(u) == 'hfoo' then
                call UnitAddAbility(u,'S000')
            else
                call UnitAddAbility(u,'S001')
            endif

with

JASS:
call RemoveUnit(CreateUnit(Player(0),'hfoo',0.,0.,0.))
 

Attachments

  • Foobar.w3x
    16.4 KB · Views: 52
Level 31
Joined
Jul 10, 2007
Messages
6,306
Chaos abilty does not cause lag :D if you like to transform , use the transform abilty as bear form , because chaos cause damage bugs when you add its again .

We're talking about viable solutions to Unit Replacement that are leakless = ). This would allow unit recycling systems to reduce crashing on large spawning maps and it'd also allow unit transformations =). I'd eventually create an lua script that'll parse over all of the unit objects in the Object Editor. From here, each level of a specific ability would be attributed to a specific unit. For example, if I were to use Chaos, Chaos lvl 0 would always be root unit, lvl 1 might be peasant, 2 might be footmen, 3 might be ghoul, and etc.

I don't see what's so important about keeping ids in most situations.

Because it's important any time you want to store the unit???
unit u = CreateUnit(...)
unit u2 = u

--replace
RemoveUnit(u)
u = CreateUnit(u)

uh oh.. u2 no longer points to the unit o_O. If we were to use Chaos for replacement, both u and u2 would still point to the unit.
 
Status
Not open for further replies.
Top