Clan TMMM
Would you like to react to this message? Create an account in a few clicks or log in to continue.


The official site of Clan TMMM
 
HomeHomeSearchLatest imagesRegisterLog in


Latest topics
» Kevkevqaz is back
Memory Leaks I_icon_minitimeby Eat_bacon_daily Wed Feb 22, 2023 7:22 pm

» Hey whats up
Memory Leaks I_icon_minitimeby seankly Tue Feb 04, 2020 10:32 pm

» Gotta click fast - WC3 Mazing #mildlyinteresting
Memory Leaks I_icon_minitimeby hoffmann Wed Jun 21, 2017 10:28 pm

» I'm getting married and you guys are invited
Memory Leaks I_icon_minitimeby Achilles.42 Wed Sep 07, 2016 11:00 am

» Server Photo Album 1
Memory Leaks I_icon_minitimeby Pat1487 Sat Aug 06, 2016 5:28 pm

» Legacy of The Void Beta
Memory Leaks I_icon_minitimeby Achilles.42 Sun Oct 18, 2015 3:21 am

» Hey guys!!!
Memory Leaks I_icon_minitimeby Eat_bacon_daily Fri Oct 16, 2015 11:20 pm

SC2 Links
SC2 Challenge/Tourney Info

Official SC2 Forums

SC2 Curse

SC2Mapster

Team Liquid

SC2 Replayed

SC2 Strategy
WC3 Links
Clan_TMMM[Host] Info

WC3 Challenge/Tourny Rules

Epicwar
Poll
What game does everyone play now?
Starcraft 2
Memory Leaks I_vote_lcap26%Memory Leaks I_vote_rcap
 26% [ 8 ]
Warcraft 3
Memory Leaks I_vote_lcap35%Memory Leaks I_vote_rcap
 35% [ 11 ]
League of Legends
Memory Leaks I_vote_lcap19%Memory Leaks I_vote_rcap
 19% [ 6 ]
World of Warcraft
Memory Leaks I_vote_lcap0%Memory Leaks I_vote_rcap
 0% [ 0 ]
Diablo 2
Memory Leaks I_vote_lcap0%Memory Leaks I_vote_rcap
 0% [ 0 ]
No games at all
Memory Leaks I_vote_lcap10%Memory Leaks I_vote_rcap
 10% [ 3 ]
Other game not listed
Memory Leaks I_vote_lcap10%Memory Leaks I_vote_rcap
 10% [ 3 ]
Total Votes : 31
Transparency

 

 Memory Leaks

Go down 
+2
Pat1487
SEXorWAR-CRAFT
6 posters
AuthorMessage
SEXorWAR-CRAFT
Corporal
Corporal




Memory Leaks Empty
PostSubject: Memory Leaks   Memory Leaks I_icon_minitimeFri Apr 17, 2009 4:23 pm

Anyone know how to remove a memory leak from an array?
call DestroyGroup( udg_tempGroup ) would be for a reg group variable.. but what about an array?
and what about when you use integer A.. is there a way to incorporate it into the trig?
Back to top Go down
Pat1487
Moderator
Moderator
Pat1487



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeFri Apr 17, 2009 5:36 pm

Arrays work the same for memory leaks

You can do: call DestroyGroup( udg_tempGroup[1] ) and so on to destroy them separately (as long as tempGroup is an array)

If you want to destroy them all at once with integer A you could do: call DestroyGroup( udg_tempGroup[bj_forLoopAIndex] )
Back to top Go down
SEXorWAR-CRAFT
Corporal
Corporal




Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeFri Apr 17, 2009 9:50 pm

Thank you so much Pat


Another question...

In my one trig i have multiple unit groups... if i use tempgroup for all of the unit groups and tempgroup changes throughout the trigger should i destroy the variable before reassigning or just once at the end of the trigger?
Back to top Go down
Knight of Gods
Commander
Commander
Knight of Gods



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeFri Apr 17, 2009 10:41 pm

the hobo in the yard isnt positive, but if you have unit groups inside unit groups it wont work and it should be fine to just kill it once at end
Back to top Go down
SEXorWAR-CRAFT
Corporal
Corporal




Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeFri Apr 17, 2009 10:43 pm

Its not a unit group in a unit group

Memory Leaks 288tq87

Is it good like that or should i just destroy the group at the end of the trigger?

Oh and by the way They are all different units.. they just have the same name

And Ability[#] is an array variable
Back to top Go down
Knight of Gods
Commander
Commander
Knight of Gods



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeFri Apr 17, 2009 10:55 pm

it doesnt matter you can have 1 at the end or just leave it how it is
Back to top Go down
SEXorWAR-CRAFT
Corporal
Corporal




Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeFri Apr 17, 2009 11:44 pm

And another question...

Is there a way to have unit collision turned off and the unit not be able to walk on boundary? its really annoying lol

i have unit collision turned off with a trig (turn off unit collision) but they can then walk on the black "boundary" terrain
Back to top Go down
Pat1487
Moderator
Moderator
Pat1487



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeFri Apr 17, 2009 11:48 pm

SEXorWAR-CRAFT wrote:
Its not a unit group in a unit group

Is it good like that or should i just destroy the group at the end of the trigger?

Oh and by the way They are all different units.. they just have the same name

And Ability[#] is an array variable

What do you mean by they are all different units, units of type with the same name will give you the same units

You could do it like this:

Code:
Game - Display to all players the text Level 8!
Set TempGroup = Units of type Mazeing Myrmidon Master
For Integer A from 1 to 4
  Loop
    Unit Group - Pick ever unit in TempGroup and do Actions
        Loop
          Unit - Remove Ability[Integer A] from Picked Unit
          Unit - Add Ability[5] to Picked Unit
Custom Script: call DestroyGroup( udg_TempGroup)
Custom Script: call DestroyTrigger( GetTriggeringTrigger())

You only need to set the variable (in this case TempGroup) when you want to change it, and you dont need to destroy it until your finished using it

As for unit collision, make sure the walk type in the object editor for that unit isnt set to NONE, i would use fly, but it doesnt really matter since collision is off
Back to top Go down
bloodasb
Captain
Captain
bloodasb



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeFri Apr 17, 2009 11:57 pm

OR you can write your mazes in Jass which basicallly = No leaks when you do it right lol Just sadly no one besides me and pat (maybe kog idk) can write in Jass so sigh
Back to top Go down
SEXorWAR-CRAFT
Corporal
Corporal




Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeSat Apr 18, 2009 12:06 am

Well they are all different units with the same name.. When i originally made it they all had different names and then i got bored so i changed them all to the same name.. They were based off of different units

And i changed movement type to none and it still can walk on boundary Sad



This is what it looks like when converted to custom text


function Trig_Becomelev8_Func003A takes nothing returns nothing
call UnitRemoveAbilityBJ( udg_Ability[1], GetEnumUnit() )
call UnitAddAbilityBJ( udg_Ability[5], GetEnumUnit() )
endfunction

function Trig_Becomelev8_Func006A takes nothing returns nothing
call UnitRemoveAbilityBJ( udg_Ability[4], GetEnumUnit() )
call UnitAddAbilityBJ( udg_Ability[5], GetEnumUnit() )
endfunction

function Trig_Becomelev8_Func009A takes nothing returns nothing
call UnitRemoveAbilityBJ( udg_Ability[2], GetEnumUnit() )
call UnitAddAbilityBJ( udg_Ability[5], GetEnumUnit() )
endfunction

function Trig_Becomelev8_Func012A takes nothing returns nothing
call UnitRemoveAbilityBJ( udg_Ability[3], GetEnumUnit() )
call UnitAddAbilityBJ( udg_Ability[5], GetEnumUnit() )
endfunction

function Trig_Becomelev8_Actions takes nothing returns nothing
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_111" )
set udg_TempGroup = GetUnitsOfTypeIdAll('Nbst')
call ForGroupBJ( udg_TempGroup, function Trig_Becomelev8_Func003A )
call DestroyGroup( udg_TempGroup )
set udg_TempGroup = GetUnitsOfTypeIdAll('Ntin')
call ForGroupBJ( udg_TempGroup, function Trig_Becomelev8_Func006A )
call DestroyGroup( udg_TempGroup )
set udg_TempGroup = GetUnitsOfTypeIdAll('Nngs')
call ForGroupBJ( udg_TempGroup, function Trig_Becomelev8_Func009A )
call DestroyGroup( udg_TempGroup )
set udg_TempGroup = GetUnitsOfTypeIdAll('Nalc')
call ForGroupBJ( GetUnitsOfTypeIdAll('Nalc'), function Trig_Becomelev8_Func012A )
call DestroyGroup( udg_TempGroup )
call DestroyTrigger(GetTriggeringTrigger())
endfunction

//===========================================================================
function InitTrig_Becomelev8 takes nothing returns nothing
set gg_trg_Becomelev8 = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Becomelev8, 450.00 )
call TriggerAddAction( gg_trg_Becomelev8, function Trig_Becomelev8_Actions )
endfunction
Back to top Go down
Pat1487
Moderator
Moderator
Pat1487



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeSat Apr 18, 2009 1:05 am

Whoa thats confusing, they are different units, i see what you mean now, but in GUI you cant tell

So that loop I posted before wouldnt work since they are different units
The way you did it should work though, since they are different units setting the variable is needed like the way you have it, but you dont need to destroy it until the end, but it works either way

There is one thing though, the last unit group should be:
call ForGroupBJ( udg_TempGroup, function Trig_Becomelev8_Func012A )

You should keep it in GUI for yourself though

In GUI you did the last unit group like:
Unit Group - Pick every unit in Mazeing Myrmidon Masters and do actions
When it should be:
Unit Group - Pick every unit in TempGroup and do Actions


Im still not sure what your trying to do with the different units though
Back to top Go down
SEXorWAR-CRAFT
Corporal
Corporal




Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeSat Apr 18, 2009 1:56 am

I fixed what you said.. you were right..

I was removing one ability and adding another to a unit
Back to top Go down
bloodasb
Captain
Captain
bloodasb



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeSat Apr 18, 2009 12:15 pm

Just wondering what was this fixing? aka the map? was it a maze or was it your new game you made?
Back to top Go down
Knight of Gods
Commander
Commander
Knight of Gods



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeSat Apr 18, 2009 12:48 pm

just a guess considering the units name is mazing mrymadon master its a maze lol
Back to top Go down
AmAzIn[G]
Commander
Commander
AmAzIn[G]



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeSat Apr 18, 2009 4:54 pm

Heres some help
~~~I TAKE NO CREDIT LOL i just found this helpful
FULL VERSION http://ngo.clan.su/forum/10-31-1


Leak Tutorial
Made by Clan NgO
You maybe already heard from leaks. Leaks can cause your map to lag, thus a black screen appears after playing your map.
That's because all the leaks which got created have to be cleaned/destroyed. You can fix them easily, even with out JASS experience!
But first off, I'd like to explain what a memory leak in warcraft III is.

What are leaks?

Leaks are handles which are not destroyed and just rest in your memory. It's like in school. You get many information thrown at your head, but you
automaticly forget about everything. So what would happen if we wouldn't have this "forget function" ? -Right! Our heads would overstress and getting slow.
In Warcraft III it's "basicly" the same, having more useless information, which is stored in the memory causes slow calculations.
Note that slow computers are faster affected from memory leaks than faster/better computers.

What leak in Warcraft 3?

Every handle can leak. Handles are:


Quote
# type boolexpr, button, camerafield, camerasetup, destructable, effect, event, fogmodifier, fogstate, force, gamecache, group, image, item itempool, leaderboard, lightning, location, mapvisibility, multiboard, player, quest, rect, sound, region, terraindeformation, texttag, timer, timerdialog, trackable, trigger, ubersplat, unit, widget, weathereffect

Lots of handles! But don't worry, many of this handles you will never have to clear up.
Handles which won't leak, such as Integers, Reals, Booleans & Strings.
How can I clear up those leaks?

Well you have to destroy them with JASS functions. But don't be scared if you are a GUI'er because it's not hard. For every handle type is a different destroy/remove function. Here is the list of the functions:



Now I make some examples to show you how to use them.
In the first example I remove a effect handle:



In the first example I've created a special effect and the action "Destroy (effect)".
But we don't want to destroy the special effect right after it was created! So we save the effect in a special effect variable.
Go to your Variables Editor ( CTRL + B ) and create a special effect with a desired name. In this example we've called it "Name".



After you're done with this, save the effect in your variable. Take a look at this example:



Now to remove it create a new action, which should look like this. Of course you can also put that action into your first trigger:



Now I'm gonna show you an another example. First off, I'll show you what creates the leak.
And after that how to remove it.



Here you can see a typical leak. The unit got created at location of the middle of map. The location did not got removed, thus a leak is born.
But you can easily fix that. First I create in the variables editor location variable. In this example I name the variable Loc.



As you can see, I simply created a variable "Loc" of type location. I set it up to the middle of the map.
After the unit got created I removed it again with the JASS function "RemoveLocation(whichLocation)".
You might ask why I've put a "udg_" before the name of the location. GUI created globals variable got the prefix "udg_" at the beginning of it's name.
"udg" stands for "User Defined Global" with this prefix blizzard just wanted to highlight that it's a global user variable.

There are also variables with other prefixes. For example the variables that Blizzard used in their scripts got the prefix
"bj_" and Sound variables got the prefix "gg_snd" etc.!

With the Jass New Gen Pack you can declare global variables without any prefix.

How do I clean local variables correctly?

Beside to the globals there are the locals. Locals are variables who are just created inside a function and can't used in other functions without any attach functions.
Many guys who use locals think that just destoying the handles of the locals would be all. No it isn't.
Also when you remove this handles they are still in cache cause the locals still got them.
There a easy example:



This is a typical mistake. Many guys don't know that the local "a" and "e" will be still in cache. But with two
easy and short lines of JASS also this leak will be cleaned up.



After you nullified the locals there will be no more leaks. This also should be made with globals if they aren't used anymore.
But remember you don't need to nullify the parameter inside of a function and if you got a function that return something you also have to destroy and to null the locals that arent needed anymore. It should look like this:



How I can avoid the boolexpr leak?

What would be Warcraft 3 without bugs? Right, it wouldn't be Warcraft 3! So there is a bug with the filter function but you can easily avoid it.
Here an example:



How you see I made a null at the boolxpr parameter. Well how you maybe expect, this will leak.
But you can also avoid this easily. Just make a filter function like this:



After you created this filter function you the group function should look like this:



And voilá your function is clean.

How I can avoid leaks of the GameCache?

To clean up stuff inside the gamecache there are several functions:



This are the standart functions to clean up single data.



With this function you clean a whole mission. That means all data you saved with the same missionKey string
will be cleared up. This function is good when you have saved many datas at the same missionKey and you dont want to clear up extra every data.



This function is there to clear up the whole cache.

Hint: You can just initialize 255 gamecaches.



--------------------------------------------------------------------------------

This tutorial were made by:

Hanky

Darkt3mpl3r
Greeting: WaRadius, Toadcop, JonNny and the whole NgO Clan.

Note: The attached file is the tutorial as html file.


Attachments: LeakTutorial.7z(50Kb)


--------------------------------------------------------------------------------
Back to top Go down
SEXorWAR-CRAFT
Corporal
Corporal




Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeSun Apr 19, 2009 12:37 am

It is not a maze.. although a maze is next on my list..
I just wanted to do something simple.. So my game is called Dodge The Stampede... You dodge a lot more than just dinosaurs though.... its actually very difficult and ive never seen anyone beat it yet... I wanted to get something simple under my belt first because i never finish a map... and this will hopefully be the first one i finish....
Back to top Go down
Knight of Gods
Commander
Commander
Knight of Gods



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeSun Apr 19, 2009 1:48 am

dodge the stampede... sounds odd kinda like a bad 100 rounds?
Back to top Go down
SEXorWAR-CRAFT
Corporal
Corporal




Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeSun Apr 19, 2009 2:36 am

I started working on it before i knew 100 rounds existed...
Back to top Go down
Knight of Gods
Commander
Commander
Knight of Gods



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeMon Apr 20, 2009 11:00 pm

mm right mmhmm sure i completely believe you but w/e idc
Back to top Go down
bloodasb
Captain
Captain
bloodasb



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeSat Apr 25, 2009 10:34 am

Ive played and helped test it.. its not really anything like 100 rounds. Its a game with a timer and you see how long you can last

um beastmasters use stampede (with all diff units) every 2 mins another beastmaster starts his variation of stampede. You have 24 life, if you get hit you lose one.. When u get to zero you lose.. Its all around pretty fun lol (theres alot of shit going around at once if u get past 10 mins) + it looks cool if u get a chance to play it lol Cool
And: You can chose between Sliding and walking which is fun too (noobs walk) um yea Razz

i give it a 8.5/10 Its pretty fun Razz
Back to top Go down
sube2
Recruit
Recruit




Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeTue Jul 07, 2009 1:58 am

YOu can do all that, or just make everything a local, taking out the use of globals which take up space. Local tutorial--

how to make a local-
custom script: local unit u
custom script: set u = GetTriggerUnit

the "unit" part refers to the type of variable, while the "u" refers to the name. (Locals can only be used in the same trigger they are made in, but can be used in other triggers with the "static method")

how to use a local-
custom script: RemoveUnit(u) (Notice there is no "udg_", "udg_" is only used when you are referring to a global.

how to remove memory leaks with a local
custom script: set u = null

More...

custom script: local point u[2]
custom script: Set u[2] = Point
custom script: IssueInstant(u[2])(action)
custom script: set u[2] = null
Back to top Go down
bloodasb
Captain
Captain
bloodasb



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeTue Jul 07, 2009 8:49 am

soob ur sexy =PP lol u knows so much
Back to top Go down
sube2
Recruit
Recruit




Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeTue Jul 07, 2009 10:13 am

Dude, thanks again for the badass preview/loading screen! What program are you using?
Back to top Go down
bloodasb
Captain
Captain
bloodasb



Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitimeTue Jul 07, 2009 10:24 am

Seashore ... its s sexy one that excells in fading effects, which is how i make things blend well + it allows me to upload fonts =) its sexyily ONLY FOR MAC
Back to top Go down
Sponsored content





Memory Leaks Empty
PostSubject: Re: Memory Leaks   Memory Leaks I_icon_minitime

Back to top Go down
 
Memory Leaks
Back to top 
Page 1 of 1
 Similar topics
-
» Memory leaks?
» Memory leak problems? - HELP!
» mem leaks
» Trigger Leaks

Permissions in this forum:You cannot reply to topics in this forum
Clan TMMM :: Warcraft 3 :: WC3 Tutorials and Help-
Jump to: