Here's a free program for Windows and OS X that can capture an area of your screen directly to an animated GIF:
http://www.cockos.com/licecap/
It gives you a resizable frame. You can drag the frame to the size and position you want, set the frame rate of the GIF, then hit record, choose a name for your GIF and where to save it. There will then be a couple of seconds of pre-roll and it will start to record, capturing everything that happens within the frame. You can move the frame around the screen while it's recording. Once you're done, hit stop, then your GIF is ready to upload. It's very handy for demonstrating bugs that occur when you perform certain actions, or for explaining to another user how to do something.
In addition to Licecap, here are two other freeware animated GIF creators I have used and can recommend:
GifCam
http://blog.bahraniapps.com/gifcam/Very simple and intutive but with the full range of important options (color depth, FPS choice, etc) including editing. It can be set to use RAM only or a specified temp folder for memory. Be sure you get it from the author's site not 3rd parties. Portable install, leaves no registry entries/external files.
ScreenToGif
http://www.screentogif.com/Good but much "busier" than GifCam or Licecap, can also be setup to grab video using optional ffmepg, huge amount of edit options, a bit "overkill" but take a look at it. There is a portable install option that afterwards in settings can be used to move the otherwise external ini file into its own folder, leaves an empty folder though in your Temp even when deleting the "project file", settings show warning about insufficient space in Temp even though there's plenty (in current 2.12.1 version) (
Note: changelog for new 2.13 version now says "The warning that appears when there's not enough space left on disk will only be displayed when there's less than 2GB left"--not yet verified). Adds two registry keys.
The thing I don't like about Licecap (in Sigma's post) is that once you hit "record", instead of immediately beginning the grab it takes you first to a dialog where you choose the saved file name/directory, THEN starts, so not great for catching something that's ongoing "at the chosen moment." Other than that, it also is portable if you extract the install file (7-Zip is your friend) into a folder and create a blank "licecap.ini" file within prior to start. No registry entries.