 |
WC3Jass.com "The Jass Vault"
|
Affiliates
|
|
|
| Message |
Posted:
Sun Apr 30, 2006 8:20 am Post subject:
|
|
|
If you don't assign stuff to variables, it doesn't need to be nulled.
| Code: |
function func takes nothing returns nothing
call DisplayTextToForce( GetForceOfPlayer(GetOwningPlaye (GetManipulatingUnit())), "This function leaks a lot")
endfunction
|
The only thing leaking in that is a force. To fix it
| Code: |
function func takes nothing returns nothing
local force f = GetForceOfPlayer(GetOwningPlayer(GetManipulatingUnit() ))
call DisplayTextToForce( f, "This function isnt leaking")
call DestroyForce(f)
set f = null
endfunction
|
is sufficient. |
|
|
|
 |
|
 |
|
 |
 |
|
 |
|
|
| Message |
Posted:
Sun Apr 30, 2006 11:43 am Post subject:
|
|
|
But creating a force just to display a text to one player isn't needed.
| Code: |
native DisplayTextToPlayer takes player toPlayer,real x,real y,string message returns nothing
native DisplayTimedTextToPlayer takes player toPlayer,real x,real y,real duration,string message returns nothing
|
Actualy DisplayerTextToForce uses these natives to. |
|
|
|
 |
|
|
|
| Message |
Posted:
Thu Jun 08, 2006 7:38 pm Post subject:
|
|
|
| Do boolean expressions have to be assigned to temp vars then destroyed? |
|
|
|
 |
|
|
|
| Message |
Posted:
Thu Jun 08, 2006 8:55 pm Post subject:
|
|
|
Yes, you destroy boolexpr objects. _________________ #wc3dev |
|
|
|
 |
|
|
|
| Message |
Posted:
Thu Jun 22, 2006 2:49 pm Post subject:
|
|
|
As far as I know, variables are not treated as "object" (of course, they still are a kind of "object", at least physically - with a size of four bits each, if I am not wrong), so if the object is destroyed, what is it, that leaks there!?
And as much interesting:
What is a variable, that before referenced an object, I destroy, referencing after that - if not "null"?
I asked in another place and there I was told, the variable itself is leaking...
But are not locals defined as to be deleted, when their creating function ends!?
And by setting a variable to "null", I do not destroy it, so that should not be the problem... |
|
|
|
 |
|
 |
|
 |
 |
|
 |
|
|
| Message |
Posted:
Fri Jun 23, 2006 2:47 pm Post subject:
|
|
|
Try writing an interpreter.. things will become agonizingly clear awfully quick =)
Our current understand is that there's a heap of reference counted handles. The ref count itself doesn't suicide until it drops to zero and the destructor is called. For some reason when local variables fall out of scope the ref count doesn't deincrement. Maybe there's something circular going on. _________________ jass.vim |
|
|
|
 |
|
|
|
| Message |
Posted:
Mon Jun 26, 2006 4:11 pm Post subject:
|
|
|
Mmh...
In which way did you find out that?
It seems hard to recover something like this, if one is not seeking for it... |
|
|
|
 |
|
|
|
| Message |
Posted:
Sat Aug 12, 2006 9:37 pm Post subject:
|
|
|
| What about local destructables? |
|
|
|
 |
|
|
|
| Message |
Posted:
Sat Aug 12, 2006 11:02 pm Post subject:
|
|
|
| Jass n00blet wrote: |
| What about local destructables? |
The same than any handle-derived (unit/item/destructible/doodad?/location/etc) type. You must destroy them and set the var to null. _________________ _-|-_ |
|
|
|
 |
|
|
|
| Message |
Posted:
Sat May 05, 2007 12:53 pm Post subject:
|
|
|
So when I have a function that returns a value, if I don't nullify it, it will leak? And I don't get this with H2I, how do you get your location (because it is converted to integer)
I have a strange problem with replying to posts that are 2 years old...... _________________ To much JASS for me........ |
|
|
|
 |
|
|
|
| Message |
Posted:
Mon Nov 19, 2007 9:08 am Post subject:
|
|
|
Out of curiosity -
If you use only the GUI and steer clear of JASS, how leaky will your map be? I made one that wasn't too complicated and started to get monster lag. I'm curious whether I made some redundant loop somewhere or if the GUI is just terrible about leaks. _________________ ~Demon |
|
|
|
 |
|
|
|
| Message |
Posted:
Mon Nov 19, 2007 2:29 pm Post subject:
|
|
|
if you clean leaks in GUI correctly, using custom script, thw hole thing can be called Jass if you remove every leak then your script is more jass than gui... and if your map is too laggy, remove some triggers, or learn jass _________________ Projects:
SupCom | WC3 FlightSim | JASS Benchmark |
|
|
|
 |
|
 |
|
 |
 |
|
 |
|
|
| Message |
Posted:
Mon Nov 19, 2007 4:28 pm Post subject:
|
|
|
| demonpants wrote: |
Out of curiosity -
If you use only the GUI and steer clear of JASS, how leaky will your map be? I made one that wasn't too complicated and started to get monster lag. I'm curious whether I made some redundant loop somewhere or if the GUI is just terrible about leaks. |
If you are doing a campaign map, where most of the triggers are simple one-shot triggers, leaks should generally not be a concern. Especially when doing cinematic cutscenes, cleaning up leaks is not worth the trouble. But if you are doing an AOS or Tower Defense or anything with triggered spells, for example, you should definitely clean up your leaks. |
|
|
|
 |
|
 |
|
 |
 |
|
 |
|
|
| Message |
Posted:
Thu Dec 20, 2007 5:16 pm Post subject:
|
|
|
| Bob666 wrote: |
if you clean leaks in GUI correctly, using custom script, thw hole thing can be called Jass if you remove every leak then your script is more jass than gui... and if your map is too laggy, remove some triggers, or learn jass |
Yeah, I've since learned Jass, I was just debating on rewriting all the triggers in that map or not.
And Kattana – yeah, the map had a whole lot of periodic triggers and also managed the AI of up to 500 units, so I'm sure there were tons of leaks. That would probably he hard to get efficient even with JASS. _________________ ~Demon |
|
|
|
 |
|
 |
|
 |
 |
|
 |
|
|
| Message |
Posted:
Mon Nov 17, 2008 1:40 am Post subject:
|
|
|
| JadedOnslaught wrote: |
| Code: |
function func takes nothing returns nothing
call DisplayTextToForce( GetForceOfPlayer(GetOwningPlaye (GetManipulatingUnit())), "This function leaks a lot")
endfunction
|
| Code: |
function func takes nothing returns nothing
local force f = GetForceOfPlayer(GetOwningPlayer(GetManipulatingUnit() ))
call DisplayTextToForce( f, "This function isnt leaking")
call DestroyForce(f)
set f = null
endfunction
|
|
This confuses me. I looked up GetForceOfPlayer() in this sites (btw awesome) Function finder and it says:
| Code: |
function GetForceOfPlayer takes player whichPlayer returns force
local force f = CreateForce()
call ForceAddPlayer(f, whichPlayer)
return f
endfunction
|
Shouldn´t this leak? It sets a handlechild variable and doesnt null it - because it has to return it.
So you can´t use this blizzard´s BJ like function leakfree at all. The only way would be to "rebuild" it with the native ForceAddPlayer() in your own function. Like this:
| Code: |
function func takes nothing returns nothing
local force f = CreateForce()
call ForceAddPlayer(f, GetOwningPlayer(GetManipulatingUnit()) )
call DisplayTextToForce( f, "This function isnt leaking")
call DestroyForce(f)
set f = null
endfunction
|
|
|
|
|
 |
|
 |
|
 |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|