Re: Memory Leak
Re: Memory Leak
- Subject: Re: Memory Leak
- From: Scott Ribe <email@hidden>
- Date: Mon, 26 May 2008 16:04:24 -0500
- 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)?
Note that Marshall's message was talking about global objects. More
explicitly, global objects, not global pointers to objects. In other words,
there are *many* objects that won't have their destructors called just
because main exits, in other words will never have them called unless the
programmer deletes them during main. On the other hand, a single global
object that is destroyed after main exits could be the root of a large graph
of objects, and could result in the delete/destruction of many owned
objects.
> If your destructors are taking a long time (and 20 seconds at program
> exit is a long time), then Shark is your friend - it can tell you how
> the CPU is spending all that time....
In the case I mentioned, I can tell you exactly where the time went: delete,
delete[], free. Now it was a long time ago ('030 days IIRC), and on today's
processors freeing those several millions of objects wouldn't take long. Of
course, on today's processors, I can & do work with larger data sets, and
might still run into an objectionable albeit shorter delay, were I to go
back and tweak the code to delete the object cache at quit.
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice
_______________________________________________
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