Re: [Dev-C++] RES: RES: RES: Question about software design
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Pink B. <da...@ya...> - 2007-11-21 18:47:21
|
Andr=E9 Mac=E1rio Barros sez, > Sorry, but I didn=B4t understand the stack realease sfuff... Local variables are generally allocated on the functions stack frame. Once you return from a function the local variables are no longer valid. A pointer to a local variable is no longer valid once you've returned from the function. Thus you need to take a lot of care when referencing local variables via pointers. =20 > -->Suppose I make a lot of malloc=B4s during the > execution of my program. Then I finish the execution (without > "freeing" the memory). > -->Does all the "malloced" memory return to > the Operating System and can be considered available again? With Winders, probably. Other OS's probably not. The real issue is that not keeping track of memory that has been allocated via malloc is bad programming practice as it leads directly to memory leaks. Mr Foo |