When a program crashes, is its memory reclaimed by the OS?

D

D'artagnan

Dynamically allocated (malloc) memory is returned back to the OS when a

program terminates normally. But what if the program crashes? Is its
heap also freed? Thanks.
 
L

Luke Meyers

D'artagnan said:
Dynamically allocated (malloc) memory is returned back to the OS when a

program terminates normally. But what if the program crashes? Is its
heap also freed? Thanks.

That depends entirely on the OS. The C++ standard has nothing to say
on the matter -- wrong jurisdiction. However, generally speaking, yes,
most OSes will reclaim all such memory.

Luke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top