Thread: memory leak and process terminated

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    16

    memory leak and process terminated

    Hi all,

    I have a question about process exit condition due to memory leak.
    If no system memory available caused by memory leak and that lead to processes termination, what will be the exit code of the affected processes?

    Thanks a lot! :redface

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    man page wait section 2
    It depends how badly the code is written.

    For well-written code that checks for NULL on each malloc, or eventually catches an exception in C++, then I would say some documented non-zero exit status would be appropriate.

    But if it's crap code, it probably crashes out with a segmentation fault.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2009
    Posts
    16
    Got it! Thank you~

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking if a process has terminated?
    By Elysia in forum Linux Programming
    Replies: 26
    Last Post: 11-22-2011, 06:29 PM
  2. Process Terminated with status -1073741510
    By Varethien in forum C Programming
    Replies: 5
    Last Post: 08-09-2011, 04:16 AM
  3. Process terminated with status -1073741819
    By smithx in forum C Programming
    Replies: 5
    Last Post: 11-01-2010, 11:13 PM
  4. Replies: 2
    Last Post: 09-28-2006, 01:06 PM
  5. memory leak
    By houssam_ballout in forum C++ Programming
    Replies: 12
    Last Post: 05-20-2006, 02:09 AM