If using C and you declare a variable within a function, the memory allocated is freed once the function is exited. I'm assuming this memory housekeeping is done by the C compiler. As Steve says, if you do a discrete allocation of memory in your program, you should free it when done and before exiting your program.
You guys are working at a much lower level and the rules under that environment are foreign to me.