Phlip wrote:
mangesh wrote:
Is there any function in standard library that can forcefully release
memory associated with a process(applica tion) ?
No.
Correct.
That's because you are expected to write clean code that follows (at
least) RAII. Look that up.
Clean code is good. RAII is good.
However, those are *not* the reason for the lack of a release_memory( ) in
the standard. The point is: there is no way at all in standard C++ to
return memory to the operating system -- neither delete() nor free() make
any promisses in this regard. The standard refrains from making any
guarantees about this because it does not want to impose unnecessary
restrictions on the execution environment, in other words: the C++
standard does not force the operating system to take back its memory.
If you need to deal with memory on the OS level, you should use system
calls. But those are platform specific.
Best
Kai-Uwe Bux