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

[JASS] leaks?

Status
Not open for further replies.
Level 11
Joined
Jun 13, 2007
Messages
570
when creating a text tag and using the SetTextTagLifespanBJ(tag,real), does it also destroy and cleanup the tag so it doesn't leak or do I still need to call DestroyTextTagBJ(tag)
 
Level 11
Joined
Jun 13, 2007
Messages
570
Yeah... I been having a few issues with memory leaks and I cant find the source of the leak. Every group, location, rect, effect that is created is destroyed before the trigger finishes

this was the only thing I could find and think of

I added a manual clean up as well gonna test it later and see if there is a difference
 
Level 11
Joined
Jun 13, 2007
Messages
570
regions i only use with boolean statements IsUnitInRect(rect,unit)

triggeractions i dont generate new ones, just the ones that are associated with the init triggers as events

dont use any trigger conditions, i do everything within the trigger if needed

triggers, 90% of the triggers i use get destroyed upon use (the other 10% is repeating triggers, I dont have any that I generate on the fly)

timers, well this leads me to another question, if i use a global timer variable, do i have to destroy it every time I reset the timer and start it again... if so that is probably my issue....

groups, I destroy all of those

dummy units get removed, checked those too

lightings, other... dont really use much of that

effects, i destroy them all

and for the most part 99% of my code calls natives directly, I been fixing that slowly. I have a bad habbit of forgettin a native's name so I just grab the function from the GUI command and bring it in
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Nono, regions, not rects. (You probably don't use them if you don't know the difference)

Timers; no, only for locals.

Not sure, then... Sometimes leaks can be a pain to find, especially when you think you clean them but a thread crash or something causes them to occur (because the function never gets to the point where it can clean them)
 
Level 11
Joined
Jun 13, 2007
Messages
570
i know the difference, i have used them both before, i just read what you said wrong (no regions in my functions on this project... at least I dont think so... i'll have to double check that)

and yes, they are a pain in the ass to find... i'll figure this out eventually
 
Level 11
Joined
Jun 13, 2007
Messages
570
it was a multibord item that was being properly released, but the variable was not being set to null afterwards... figures
 
Level 11
Joined
Jun 13, 2007
Messages
570
when i added the set myMBItem = null at the end

the function stop leaking, it was really weird, because I never thought that something like that would leak
 
Level 11
Joined
Jun 13, 2007
Messages
570
well the multiboard updates every 0.25s on a timer, so if the game lasts several hours, no wonder people noticed it in the long run.

I went through over 90% of my code already and added nulling of variables that used handles (units, rects, groups, etc) mainly on the functions that repeated often, and over an hour play I noticed about a 10mb difference in the memory that wc3 used

anywho.. thanks for your help
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Every .25s on a timer should not cause any problems. Shouldn't even get close.

If you're getting a 10 mb memory difference, you'd have to be leaking a lot if it was only from nulls. (which I doubt... imagine how many variables you'd have to have used that you didn't null, that weren't primitive types!)

You probably have several other leaks lurking around somewhere.
 
Status
Not open for further replies.
Top