NXT-G Large Program Tips

Save your work often. Don't overwrite the same save file over and over again though. Once your program gets to a reasonably large size and you have a working version, save that file, then do a save-as and save it under a new name. When I start a program, it may be called 'touchNXT'. After the program gets quite large I'll start saving 'touchNXT-1', 'touchNXT-2', etc. This way I can refer back to any of the previous version and if something corrupts my latest version I can go back one and reapply the changes manually.

Copy and Paste - Drag and Drop - Move Icons

Don't do it. Once your program gets to a certain size, dragging and dropping icons will cause NXT-G to bog down or crash. If you drag and drop and icon and NXT-G seems to freeze up, check your task manager - it is probably taking up 100% of your CPU and possibly eating up your memory. If you wait a minute or two it may come back. Once it does, save your program, then exit NXT-G, kill the mindstorms process if it is still alive, then re-open.

Now that your program is this large, give up on the idea of drag and dropping existing icons. You'll still be able to create new ones by dragging them over from the icon palette, but any dragging and dropping of existing icons will cause the same slow down and possible crash. There is no way around it - just make your peace with it :)

My Blocks

My blocks will without a doubt be your best defense against NXT-G crashing when building large programs. If at all possible try and break your program down into different My Block segments. If you have to do the same series of commands in more than one place, then create a my block and you'll be much better off. The program size on the NXT doesn't seem to change much if you use my blocks, but the NXT-G programming environment seems to depend on the number of icons you have in your program. If you've got 20 icons buried in a my block, the NXT-G environment only seems to worry about the 1 my block you are using and will work that much better.

Be Patient

When you do a drag and drop operation and the system seems to freeze-up, just wait. It may come back. Give it at least a couple of minutes before giving up. When this happens on my system I see the MINDSTORMSNXT.exe process maxing out one of the CPUs and it gobbles up about 1.2GB of RAM. After waiting a few minutes it will sometimes come back and allow me to save the program. At that point I know to no longer drag and drop existing icons, but I can create new ones (see above).

Exit and Re-open

Take a look at Task Manger when you start mindstorms on your computer. Note how much memory it takes up when it starts - on mine MINDSTORMSNXT.exe hits about 128MB on startup. Keep an eye on task manager and when it MINDSTORMSNXT.exe starts taking too much memory, save and exit your program. For me I wait until it gets over 1GB, then I know it's time to exit and re-open the program I was working on. If I keep working over 1GB, I'll often get a crash and 'memory full' error.

If you've done any programming in NXT-G, then you already know that the more blocks you add to a program in NXT-G, the more frequent and likely crashes become. Here are some tips to help you with large programs in NXT-G.Save Early, Save Often