Re: is such exception handling approach good?

Tech-Archive recommends: Speed Up your PC by fixing your registry



"George" wrote:
When an application is terminated as we discussed before, the
resources
should be released automatically. So, I think when the
application
terminates, the destructors of all existing objects should be
invoked?

No, of course not. OS knows nothing about classes and objects.
When process terminates, then system reclaims whatever process
acquired during its lifetime: allocated memory, GDI objects,
opened handles and some other resources. But what exactly resided
in this memory (C++ object or FORTRAN code or .NET whatnot) is
internal knowledge of the process. So, if a developer didn't write
proper clean-up code to revert internal objects to some valid
state, then they will be killed as is. System doesn't know and
doesn't care obout your objects.

Alex


.



Relevant Pages

  • Re: Using PerfMon to hunt for memory leaks
    ... that there doesn't seem to be any leakage occurring. ... the program frees all of the resources when it terminates because PerfMon stops ... If it keeps going up as you create and destroy more windows, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: pthread_join
    ... thread stack) are retained by the Pthreads implementation. ... you detach a thread, you tell the Pthreads lib that it can release all ... the resources associated to the thread when it terminates. ...
    (comp.programming.threads)
  • Re: finalize() not guaranteed to be called -- ever
    ... if you are just looking for a clean solution to free your resources ... > when the application terminates, I think Ingo gave you a good answer. ...
    (comp.lang.java.programmer)