| 11-29-2004, 12:17 PM | #1 |
Hello, this (php) script will show you all memory leaks in your trigger: http://manithu.ma.funpic.de/leak_indicator.php You just have to paste your trigger in the textarea, select if the trigger is jass or gui and if you want to see all leaks or only the important, then press 'Show Leaks'. Leaking handles will be highlighted with red background color. The counter is very inaccurate when GUI triggers are entered. Warning: If you use 'one-line ifs' (If condition Then action Else action, not If (If Actions) Then (Then Actions) Else (Else Actions), splitted in several lines) and set a variable in the 'Then' or 'Else' part, it will wrongly show up as a leak. The source code is also available: http://manithu.ma.funpic.de/leak_indicator.source.php If you're good in php and know some improvements, feel free to contact me (via pm, email, etc.). Regards, Manithu/0siris |
| 11-29-2004, 02:45 PM | #2 |
neat idea. ok just because i have to type at least 10 characters i just wrote what you are reading. |
| 11-29-2004, 04:31 PM | #3 |
Thanks. Important: I have just found a bug that ignores 'Set' when whitespaces are in front of it, and therefore shows up as a leak. This will be fixed till tomorrow. |
| 11-29-2004, 10:06 PM | #4 |
as to why it thinks the variable must be a global when saving it to clean the leak? or why it thinks RemoveLocation(Location(0,0)) leaks. |
| 11-29-2004, 10:42 PM | #5 |
It doesn't find actual leaks like in: Code:
function R takes nothing returns nothing local group G = CreateGroup() endfunction |
| 11-30-2004, 07:37 AM | #6 |
Guest | So funny, everything that is meant to clean up the leaks is shown as leaks XD. At least you found it. Should make it so it scans all the code and conclude the actual leaks (since some leaks are cleaned at some points). |
| 11-30-2004, 05:31 PM | #7 |
Lord Vexorian, PitzerMike & arcanister: Thanks for reporting those bugs,. I have fixed them :) Local variables that are not destroyed afterwards will also be indicated with red background color from now on. The bug that one I mentioned in a few posts before is also fixed (it happened when you enter scripts with another charset than UTF. Greetings, Manithu |
| 12-01-2004, 04:17 AM | #8 |
Guest | Local variables (location,group) that are destroyed or cleaned still show up as leaks. Some (trigger variable) don't show up as leaks. I don't remember all leakable types, but there shouldn't be any exception. |
| 12-01-2004, 04:08 PM | #9 |
Now it should display them correctly ;) Ok, local trigger vars do now also show up as a leak. I am not sure if I should also let globals highlight, because in many cases the global trigger var is needed in an other trigger and therefore should not be destroyed.. |
| 12-01-2004, 06:07 PM | #10 |
Here's a design I made for the script. http://www.sw0bes.com/mlindicator/ But one thing I want to know, it shows the leaks...but how do I fix them? Like for instance it says GetRectCenter( blah ) is a leak, but doesn't show how to fix. |
| 12-02-2004, 04:25 PM | #11 |
Looks very nice :> Hrm, I will link to http://www.wc3campaigns.com/showthread.php?t=55022 , where Cubasis explains how to fix them. Additionally I will add the name of the function that destroys the leak in the title attribute of the leak. //edit: I will not add this because it is too much work In the source code you mention that the xhtml code is breaking mozilla. Strange, because I have tested it with Mozilla 1.5, Opera 7.6 and Firefox 1.0. They have all displayed the application/xhtml+xml correctly ;) |
| 12-02-2004, 05:19 PM | #12 | |
Quote:
It's because you are defining data before sending the <!DOCTYPE>, which should always be the very first thing sent... Other than that...I'm clueless as to why it breaks everything except IE. Edit: Also, a good idea might be to add function linking on errors. Ex: GetRectCenter() would be a link to a thread explaining how to fix that leak. And it's easy as pie to implement. |
| 12-02-2004, 05:59 PM | #13 |
That is not true. Headers should and must be sent before any data is outputed (like <!DOCTYPE>). The first lines sends xhtml as "application/xhtml+xml", which is the correct mime type of xhtml, but only if the user agent accepts application/xhtml+xml. IE does not accept it, and will get the default html mime type "text/html". It could be that some Mozilla versions accept xhtml, but not display it correctly. I have attached a screenshot showing the page with 4 browsers (Opera 7.6, Firefox 1.0, Mozilla 1.7.3, Internet Explorer 6). |
| 12-02-2004, 06:18 PM | #14 | |
Quote:
Well my design breaks when I uncomment that code, and my code is valid so I don't know what else it could be. |
| 12-03-2004, 12:12 PM | #15 |
Guest | The fake leaks are still displayed (like location with RemoveLocation after that). Would be extremely useful if this is done. |
