Re: What MFC Objects Can't be created on the Stack?
I'm not compiler designer, but I would imagine the GC algorithm would be a
bit tricky to optimize. If, on one hand, it is called too often it will
slow down execution of the program and, on the other hand it is called to
infrequently the memory usage may fragment or expand and that would also
slow down the program. Leaving it up to the programmer makes sense to me
since then it becomes their responsibility to manage the memory. I know
that programmers are considered unreliable these days, but I'm from the old
school :o)
Tom
"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message
news:e8DgvG2uGHA.1504@TK2MSFTNGP03.phx.gbl...
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:j1iid25doeskd4serp2ffj2a30heolbnm3@4ax.com...
Actually, this wouldn't be true in either Java or .NET either. Objects
exist in those
systems even if they are not being used.
In .Net, object exists until there GC comes around to take it away.
However
that may never happen, if GC does not get called or may happen much later
wasting GDI resources. .Net/C# provides IDisposable/using construct to
make
it behave like what happens in CGDIObject: destroy the underlying GDI
object
when wrapper goes out of scope. So the same issue exists in .Net as well.
--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com