diff options
author | Michi Henning <michi@zeroc.com> | 2003-10-23 06:22:17 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2003-10-23 06:22:17 +0000 |
commit | 0fdb3361e7525f4f49556d1233d9b84c566ec6fb (patch) | |
tree | f128daba58f02bfc2c3a4d975c001eeab2562b43 /cpp/src/IceUtil/GC.cpp | |
parent | fixes (diff) | |
download | ice-0fdb3361e7525f4f49556d1233d9b84c566ec6fb.tar.bz2 ice-0fdb3361e7525f4f49556d1233d9b84c566ec6fb.tar.xz ice-0fdb3361e7525f4f49556d1233d9b84c566ec6fb.zip |
- Renamed ObjectBase to GCShared.
- Fixed the problem of the gc test sometimes running for over three
minutes.
- Fixed race condition in printGCStats if a signal caused communicator
shutdown.
Diffstat (limited to 'cpp/src/IceUtil/GC.cpp')
-rw-r--r-- | cpp/src/IceUtil/GC.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/cpp/src/IceUtil/GC.cpp b/cpp/src/IceUtil/GC.cpp index 9182bcecbcf..ecf567cadfe 100644 --- a/cpp/src/IceUtil/GC.cpp +++ b/cpp/src/IceUtil/GC.cpp @@ -14,7 +14,7 @@ #include <IceUtil/GC.h> #include <IceUtil/Time.h> -#include <IceUtil/ObjectBase.h> +#include <IceUtil/GCShared.h> #include <map> @@ -22,15 +22,15 @@ namespace IceUtil { void -recursivelyReachable(ObjectBase* p, ObjectSet& o) +recursivelyReachable(GCShared* p, GCObjectSet& o) { if(o.find(p) == o.end()) { assert(p); o.insert(p); - ObjectMultiSet tmp; + GCObjectMultiSet tmp; p->__gcReachable(tmp); - for(ObjectMultiSet::const_iterator i = tmp.begin(); i != tmp.end(); ++i) + for(GCObjectMultiSet::const_iterator i = tmp.begin(); i != tmp.end(); ++i) { recursivelyReachable(*i, o); } @@ -129,7 +129,7 @@ IceUtil::GC::collectGarbage() _collecting = true; } - typedef map<ObjectBase*, int> ObjectCounts; + typedef map<GCShared*, int> ObjectCounts; ObjectCounts counts; Time t; @@ -144,10 +144,10 @@ IceUtil::GC::collectGarbage() } // - // Initialize a set of pairs <ObjectBase*, ref count> for all class instances. + // Initialize a set of pairs <GCShared*, ref count> for all class instances. // { - for(ObjectSet::const_iterator i = objects.begin(); i != objects.end(); ++i) + for(GCObjectSet::const_iterator i = gcObjects.begin(); i != gcObjects.end(); ++i) { assert(*i); counts[*i] = (*i)->_ref; @@ -165,11 +165,11 @@ IceUtil::GC::collectGarbage() // For each reachable instance, decrement the reachable instance's ref count. // { - for(ObjectSet::const_iterator i = objects.begin(); i != objects.end(); ++i) + for(GCObjectSet::const_iterator i = gcObjects.begin(); i != gcObjects.end(); ++i) { - ObjectMultiSet reachable; + GCObjectMultiSet reachable; (*i)->__gcReachable(reachable); - for(ObjectMultiSet::const_iterator j = reachable.begin(); j != reachable.end(); ++j) + for(GCObjectMultiSet::const_iterator j = reachable.begin(); j != reachable.end(); ++j) { --(counts.find(*j)->second); } @@ -182,7 +182,7 @@ IceUtil::GC::collectGarbage() // (and all instances reachable from them) from the overall set of objects. // { - ObjectSet reachable; + GCObjectSet reachable; for(ObjectCounts::const_iterator i = counts.begin(); i != counts.end(); ++i) { if(i->second > 0) @@ -191,7 +191,7 @@ IceUtil::GC::collectGarbage() } } - for(ObjectSet::const_iterator k = reachable.begin(); k != reachable.end(); ++k) + for(GCObjectSet::const_iterator k = reachable.begin(); k != reachable.end(); ++k) { counts.erase(*k); } |