| 10-23-2007, 11:30 AM | #1 | |
Quote:
Now I know handles occupy 4 bytes, but not nulling them does not mean that local reference memory is not freed after function ends. Is there any solid proof of this claim? |
| 10-23-2007, 11:56 AM | #2 |
no Vex is joking i allready told u =) if it's a CONSTANT object so there it's doesnt leak anything... and you allreadysad the only TRUE fact it will simple not free the used handle (as index) so the number fo used handles will increse. == leak O.O // i have tested this myths alot so you can trust me xD and don't waste time on it. |
| 10-23-2007, 12:12 PM | #3 |
This is what I understand from reading stuff people have posted over the years:
|
| 10-23-2007, 02:13 PM | #4 | |
Quote:
omg well simple to say u are wrong. (and you are not the only one) don't read crap on forums just test it self ! =\ |
| 10-23-2007, 02:14 PM | #5 | |
Quote:
When you call RemoveHandle() The handle is destroyed, this freeds memory used by that object. But since there are still references to that object and blizzard didn't want to make access violations even more probable than they are now they place an empty holder in that address. Easy? "proof" JASS:function aaa takes nothing returns nothing local location loc=Location(0,0) call RemoveLocation(loc) endfunction Run it periodically and frequently, watch memory usage raise... Sure it also prevents handle id recycling and that slows the game down probably a much worse effect than the memory usage (which is just 4bytes, most handles should take much more than that), unless you really do this plenty of times... -- Edit: Also, if you use typecasts to store pointers and make sure to clean all of a handle's references after destroying it, then try using a normal native on the restored reference, it would crash. On normal circunstances with the placeholders in action it will just do nothing. |
| 10-23-2007, 02:30 PM | #6 |
Well those "referece struct" are inside jass virtual machine implementation, and it seems strange that someone would make a condition that local variables implementation structs will not get recycled unless they are nulled, that would mean that local integers need to be nulled as well and that is just too lame to be truth. I presume PipeDream could shed some more light on this subject hmmmm? EDIT: Have seen that placeholder thing just now... ZOMFG.. blizzard sux balls so hard. I wonder why they even bothered implementing that feature when GUI does not even clean leaks, let alone nulls locals... |
| 10-23-2007, 02:32 PM | #7 | |
Quote:
It is not strange, it is a bug. Arguments don't do that. I don't see why would this imply integers need to be nulled. |
| 10-23-2007, 02:41 PM | #8 |
One question, are those unnulled references all pointing to the SAME placeholder or they all have their own? |
| 10-23-2007, 02:50 PM | #9 |
If the references used to point to the same handle they would then point to the same place holder. |
| 10-23-2007, 03:32 PM | #10 |
Again it does not make sense, if I wanted to make my virtual engine crash resistant I could simple make all references point to same placeholder and it would all be ok, it is a concept of NULL class. bugs bugs bugs.... EDIT: arguments eh. JASS:private function Actions takes nothing returns nothing call SetUnitUserData(GetTriggerUnit(), GetUnitUserData(GetTriggerUnit()) + 1) endfunction |
| 10-23-2007, 04:38 PM | #11 | |
Quote:
wc3 is the last normal game (with some content) + you must don't care about and trying to avoid such stupid situation. (bugs) well the current problem in truth is not a problem... ^^ |
| 10-23-2007, 07:20 PM | #12 | |
Quote:
JASS:private function Actions takes unit U returns nothing call SetUnitUserData(U, GetUnitUserData(U) + 1) endfunction |
| 10-23-2007, 10:48 PM | #13 |
JASS:function aaa takes location dummy returns nothing set dummy=Location(0,0) call RemoveLocation(dummy) endfunction Fixed? |
| 10-23-2007, 11:12 PM | #14 |
Yes. |
| 10-24-2007, 06:34 AM | #15 |
Tutorial ffs Anyways I finally understand that reference structs, it is quite smart thing actually, it prevents jass scripts from directly accessing in-game memory, and since every reference must have a reference struct, the higher reference count is, the laggier the game will be, it does not matter if you use gamecache or not. I just hope those noobs in blizzard did not implement linear algorithm for recycling... |
