{"issue":{"user":{"id":1274265,"login":"Pala22","url":"https://api.github.com/users/Pala22","gravatar_id":"124c41062238c86056ee2bec72282def","avatar_url":"https://secure.gravatar.com/avatar/124c41062238c86056ee2bec72282def?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"milestone":null,"title":"If you have Out of Memory & Random Freezing READ FOR FIX","created_at":"2011-12-20T07:17:09Z","updated_at":"2011-12-22T16:17:30Z","labels":[],"state":"open","id":2610002,"html_url":"https://github.com/BinaryConstruct/Terraria-Map-Editor/issues/178","closed_at":null,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":178,"body":"As someone who has only used TEdit for a few days I have to say I'm impressed by the ease of use and I know from experience that making a user friendly UI is tricky to say the least.\r\n\r\nBut that isn't why I'm here, my problem was that I was getting the odd crash with the out of memory error log but mostly I was getting random freezes and getting \"this program is not responding\" messages from OS. So I decided to look into it and found that for sum ppl it seemed disabling undo fixed it, but that didn't work for me.\r\n\r\nSo I decided to try my old friend LAA(Large-Address-Aware for those who don't know) now on a 32Bit OS this will probably not do anything but on a 64Bit OS (which is what about 90+% of Vista & Win7 OS's are) it allows a 32bit program to utilize the main part of the 64Bit architecture which is allowing more than 4,294,967,295 Bits (4Gb) of system memory the 32bit Architecture is limited to by complicated math. But even then almost all 32Bit OS's limited that down even further to 3.12GB for stability, which means that 32Bit programs were limited to being able to use only 2Gb of system memory. But that is Deceptive as I Stressed TEdit and it never went over 1.7Gb with LAA enabled so why does enabling LAA work?, it's because although it doesn't use over the 2Gb limit of 32bit it also means that it cannot do large read & writes to the memory a.k.a. large addresses without the LAA flag enabled. With LAA enabled using CFF Explorer http://www.ntcore.com/exsuite.php I haven’t had any more problems and with testing I can for example run the max eraser of 200 across the map and the program will slow down or even appear to have frozen but it will never crash or actually freeze and it then will recover when u stop doing the insane edit. Even when you undo that same edit there is a similar slow/freeze but still not a crash or proper freeze.\r\n\r\nNow the fix is either everybody who has the problem can do the fix using CFF Explorer after downloading TEdit or u can add it to the program source code by doing a Post-build Event now I tested this myself a bit but not extensively, but LAA should not affect ppl using a 32bit OS it doesn’t really change anything as it only allows a program too use large addresses not forces it too. Steps for both options are as follows.\r\n\r\nCFF Explorer:\r\n1.\thttp://www.ntcore.com/exsuite.php   Download “CFF Explorer (x86 Version, Stand-Alone, Zip Archive)”  3rd link under the opening info\r\n2.\tExtract and run CFF Explorer.exe\r\n3.\tFile – Open and navigate to TEdit location and select TEdit.exe\r\nNow it can be a little confusing to those who don’t understand but it’s pritty simple.\r\n4.\tOn the left there should be a list now, under Nt Headers select File Header and it should bring up a list on the right\r\n5.\tAt the bottom of the list “Characteristics” click on “Click Here”\r\n6.\tNow there should be a small window open, tick in the little box next to “App can handle > 2Gb address space” a.k.a. LAA, it should look like this http://img155.imageshack.us/img155/7749/cffscreen.jpg.\r\nDO NOT!! Touch any other options they can do sum bad things\r\n7.\tHit Ok then Save and Yes to \"Overwrite Original File\". Normally I would have said backup exe before doing all this but as TEdit is a small and simple download there isn’t much point\r\n\r\nAdd LAA Flag to exe in Post-Build Events of C# Project:\r\n1.\tOpen Project file\r\n2.\tOn the right in Solution Explorer right click on TEdit and open Properties\r\n3.\tOn the left click on Build Events\r\n4.\tNow click on “Edit Post-build ...” add the following 2 lines then hit ok\r\ncall \"$(DevEnvDir)..\\tools\\vsvars32.bat\"\r\neditbin /LARGEADDRESSAWARE \"$(TargetPath)\"\r\n5.\tNow save the project and recompile\r\n\r\nNow these instructions are probably over simplified but that’s because I’m used to having to simplify things down to base levels for customers of my computer business who haven’t got a single clue about the things they are trying to do, and I just realised how long this is so I’ll stop typing now  XD","url":"https://api.github.com/repos/BinaryConstruct/Terraria-Map-Editor/issues/178","comments":5,"assignee":null},"comment":{"user":{"id":456755,"login":"BinaryConstruct","url":"https://api.github.com/users/BinaryConstruct","gravatar_id":"97d17706762680821e524fcc59ebfed5","avatar_url":"https://secure.gravatar.com/avatar/97d17706762680821e524fcc59ebfed5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"created_at":"2011-12-22T16:17:30Z","updated_at":"2011-12-22T16:17:30Z","id":3250811,"body":"You would have to download all the source code and add it. I think you have a different problem. Can you upload your world somewhere (megaupload, dropbox, etc) and send me a link to it? I can test your world and see if I can find the problem. Also, be sure you have the latest version (currently https://github.com/downloads/BinaryConstruct/Terraria-Map-Editor/TEdit2.0.10.1_BETA.zip)","url":"https://api.github.com/repos/BinaryConstruct/Terraria-Map-Editor/issues/comments/3250811"},"action":"created"}