Python vs Java garbage collection?
A. Lloyd Flanagan
alloydflanagan at attbi.com
Tue Dec 31 12:47:53 EST 2002
Erik Max Francis <max at alcyone.com> wrote in message news:<3E078F70.CA68741A at alcyone.com>...
> "Martin v. Löwis" wrote:
>
> > In general, C++ makes no such guarantee. If I do
> >
> > Foo *foo = new Foo;
> >
> > and never mention foo in a delete statement, the Foo destructor won't
> > be
> > called.
>
> As he already said, he was referring to destructors in conjunction with
> reference counting entities in C++, such as std::auto_ptr.
Actually, now that I think about it, I was implicitly assuming that
C++ objects are either declared on the stack or properly deleted --
because it's generally a bug if they aren't. Martin is quite correct
in the general case.
Of course, if we're going to get too far into C++ semantics, we'll be
writing a book before we know it...
More information about the Python-list
mailing list