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

Discussion in 'C++' started by D'artagnan, May 23, 2006.

  1. D'artagnan

    D'artagnan Guest

    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.
     
    D'artagnan, May 23, 2006
    #1
    1. Advertising

  2. D'artagnan

    Luke Meyers Guest

    D'artagnan wrote:
    > 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
     
    Luke Meyers, May 23, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. klops
    Replies:
    0
    Views:
    368
    klops
    May 14, 2004
  2. www
    Replies:
    2
    Views:
    583
  3. thunk
    Replies:
    1
    Views:
    330
    thunk
    Mar 30, 2010
  4. thunk
    Replies:
    0
    Views:
    508
    thunk
    Apr 1, 2010
  5. thunk
    Replies:
    14
    Views:
    643
    thunk
    Apr 3, 2010
Loading...

Share This Page