Zombie.ccGo to the documentation of this file.00001
00002
00003
00004 #ifdef POLARIS_GNU_PRAGMAS
00005 #pragma implementation
00006 #endif
00007
00008 #include "Collection/Zombie.h"
00009
00010 #include "GC_TRACE_MACS.h"
00011 #ifdef ZOMBIE_STATS
00012 int max_zombies = 0;
00013 int cur_zombies = 0;
00014 #endif
00015
00016 Listable *
00017 Zombie::listable_clone() const
00018 {
00019 return new Zombie;
00020 }
00021
00022 void
00023 Zombie::print(ostream & out) const
00024 {
00025 out << "ZOMBIE!";
00026 }
00027
00028 Zombie::~Zombie()
00029 {
00030 #ifdef CLASS_INSTANCE_REGISTRY
00031 unregister_instance(ZOMBIE_CLASS, this);
00032 #endif
00033
00034 #ifdef ZOMBIE_STATS
00035 --cur_zombies;
00036 #endif
00037 #ifdef GC_TRACE_ZOMBIES
00038 cout<<__FILE__<<":~Zombie:"<<this<<endl;
00039 #endif
00040
00041
00042 }
00043 #define DEF_GRAVEYARD
00044 #ifdef DEF_GRAVEYARD
00045
00046
00047
00048 int graveyard_size = 0;
00049
00050 coffin graveyard[DELETE_MAX] = {0, 0};
00051
00052 void
00053 add_zombie_list(Listable *)
00054 {
00055 p_assert(0,"no longer valid");
00056 }
00057
00058 int
00059 check_zombie_list(void *)
00060 {
00061 p_assert(0,"no longer valid");
00062
00063 return 0;
00064 }
00065 #endif
00066 void
00067 dump_zombie_stats()
00068 {
00069 cout << "current number of Zombies: " << cur_zombies << endl;
00070 cout << "Max number of Zombies: " << max_zombies << endl;
00071 }
00072
00073 void
00074 dec_refs_delete_or_zombie( Listable *ptr)
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 {
00095 ; const char* context="dec_refs_delete_or_zombie:"
00096 ; int count=ptr->count();
00097 #ifdef GC_TRACE_DRDOZ
00098 ; cout<<context<<"ptr="<<ptr<<" count="<<count<<endl
00099 #endif
00100
00101
00102 ; if (count == 1)
00103 {
00104 ; ptr->ref_dec()
00105 ;}
00106 else
00107 {
00108 #ifdef GC_TRACE_DELETES
00109 cout<<context<<":deleting "<<ptr<<endl
00110 #endif
00111 ; ptr->ref_dec()
00112 ; delete ptr
00113
00114 #ifdef GC_TRACE_DRDOZ
00115 ; cout<<context<<"else-part"<<endl
00116 #endif
00117 ;}
00118 ;}
|