16.07.2012, 09:55
Yes, memory is freed as soon as the function ends. The thing is: why would you need the extra space if you're not going to use anyway? As JernejL already pointed out, there is a reserved stack portion to which all local variables are saved during function calls. If you use too much large arrays, the stack can eventually overflow and cause all kind of errors where variables overwrite each other.