Re: Memory Leak
Re: Memory Leak
- Subject: Re: Memory Leak
- From: "MacArthur, Ian (SELEX GALILEO, UK)" <email@hidden>
- Date: Tue, 27 May 2008 09:26:14 +0100
- Thread-topic: Memory Leak
> Are destructors always run (or run in the same way if called
> explicitly by the programmer or by the OS itself)? If so, it would
> seem like any delay the destructors take to run would happen no
> matter whether the programmer explicitly clean up the objects
> or just
> lets the OS do it anyway. Unless the OS runs the destructors in the
> background and so doesn't block the user interface, whereas the
> program would appear to hang while it calls them in the main thread
> before releasing the UI.
I don't know in detail what is happening "under the covers". I can only
provide this anecdote that describes some observed behaviour:
We had a large, complex (unnecessarily so in both cases, I believe) C++
project, that we built cross-platform (OSX, Linux, win32).
On exit, the original author had written the code such that it
*explicitly* called the destructors for all the widgets he'd created.
When the user clicked the exit button, the app would take 20~30 seconds
to close, and at least one of the CPU's would max out during this time.
The code was modified to *not* explicitly call the destructors.
Thereafter, when the user clicked the exit button, the app would
terminate "straight away", with no CPU maxing out.
This behaviour was observed on all 3 platforms (although all were built
using g++, so perhaps not a broad enough test basis.)
A lot of digging was done to ensure no resources were leaking and all
was found to be well. However, several of the tools used during this
digging (across the various platforms) issued warnings about leaks of
various types - all of which turned out to be false positives.
That's pretty much all I know about this... I'm not sure what I'd expect
to happen, but I know this is what does happen.
It suggests, to me, that whatever the OS does to reclaim resources on
exit, it is *not* directly calling all the widget destructors explicitly
as you would do yourself.
--
Ian
SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden