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
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
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.
Got it! Thank you~