Java also gives you enough rope to hang yourself. Just have to try a
little harder to find it.
Here is an example from production code ummm.... ummmm.... some 12 years
ago (written by someone else).
class Item {
String myKey;
Hashtable myHashtable;
.....
Item (Hashtable table, String key) {
myKey = key;
myHashtable = table;
myHashtable.put(myKey, this);
}
protected void finalize() throws Throwable {
myHashtable.remove(myKey);
}
}
Instant circular reference, no garbage collection. This brought an
enterprise-level server system down to its knees over a few hours :)
-- Kostya
27.07.2010 12:11, AlanLawrence пишет:
However, presumably (only occasionally) "screwing it up" includes
creating circular data structures...???
--Alan
On Jul 26, 10:10 pm, DanH<[email protected]> wrote:
Qt implements object assignment. One such object is a pointer
(similar pointers are implemented in other C++ dialects) that
increments a reference count in the addressed object when constructed,
decrements on destruction. You can assign the pointer and it's
copied, with appropriate incrementing. If you use the right flavor
pointer (there are several) the object will be be deleted when the
reference count goes to zero. Other flavors (linked in a reference
chain) act like weak references and go null when the object is
deleted.
All rather automatic (and atomic), with lots of (ahem, shall we say)
"less than stellar" programmers using the stuff and only occasionally
screwing it up.
On Jul 26, 3:49 pm, Bob Kerns<[email protected]> wrote:
Um, no. For Qt to do what you claim, it would have to traverse all the
application data -- including data owned by non-Qt code -- to discover
what application objects are still in use. In other words, it would
have to implement a GC.
Unless your definition of "almost exactly the same stuff" is a lot
looser than what I would think.
Would you care to give an example of which Qt API you mean? And
perhaps what binding, if that's relevant?
On Jul 26, 4:13 am, DanH<[email protected]> wrote:
That's odd, because Qt can do almost exactly the same stuff, without
weak references or implicit garbage collection, using reference chains
that the average user never has to think about.
--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en