This is OS-dependent, but really any modern operating system should take back all of your resources when you terminate.
That said, it's really a good idea to free any memory you acquire if you can -- and in all but few cases you can. Also, remember we're talking about memory here, not resources in general. There are other things you may wish to do in a proper cleanup; things the OS can't guess and can't do for you. For example, disconnect from some external service, or delete some temporary file.