-
June 7th, 2016, 07:16 AM
#1
What will happen if I brutally force to stop an application when ptrs are smart
If I use smart pointers to protect my dynamically allocated objects,
what will happen when I brutally stop an application,
will the pointers leak?
Thanks
Jack
-
June 7th, 2016, 07:20 AM
#2
Re: What will happen if I brutally force to stop an application when ptrs are smart
Well, didn't you try to " brutally stop an application"?
Victor Nijegorodov
-
June 7th, 2016, 07:27 AM
#3
Re: What will happen if I brutally force to stop an application when ptrs are smart
The Operating System will free memory owned by the application when it terminates, gracefully or otherwise.
-
June 7th, 2016, 12:13 PM
#4
Re: What will happen if I brutally force to stop an application when ptrs are smart
Read up on TerminateProcess in msdn. Typically the OS frees everything, but not always.
-
June 7th, 2016, 04:17 PM
#5
Re: What will happen if I brutally force to stop an application when ptrs are smart
Typically, everything is "freed", but not necessarily "cleanly". Files may not be flushed, temporary lock files may not be deleted, termination signals may not be sent etc...
-
June 7th, 2016, 04:20 PM
#6
Re: What will happen if I brutally force to stop an application when ptrs are smart
what will happen when I brutally stop an application,
Why do you want to do this?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
June 7th, 2016, 04:34 PM
#7
Re: What will happen if I brutally force to stop an application when ptrs are smart
Also note that forcibly terminating a program does not call the destructor of any in-scope objects. It is a really bad idea to force terminate a process.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
June 12th, 2016, 08:59 PM
#8
Re: What will happen if I brutally force to stop an application when ptrs are smart
It will Stop That's all
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|