59 if (debugger.trace(
"memory") && obj != NULL) {
60 ostream& os = debugger.getOS();
67 os <<
"*** Warning: ~Scope(): found "<< n <<
" leaked objects "
68 <<
"in scope " << d_level <<
":" <<
endl;
69 if (debugger.flag(
"memory leaks")) {
72 os << tmp->name() <<
"\n";
84 unsigned long memSelf = 0;
85 unsigned long mem = 0;
87 mem += getCMM()->getMemory(verbosity - 1);
88 if (d_prevScope != NULL) {
89 mem += d_prevScope->getMemory(verbosity - 1);
95 cout <<
"Scope " << d_level <<
": " << memSelf <<
endl;
96 cout <<
" Children: " << mem <<
endl;
97 cout <<
" Total: " << mem+memSelf <<
endl;
100 return mem + memSelf;
116 DebugAssert(d_master != NULL,
"How did this happen");
128 d_master->restoreData(d_data);
129 d_master->d_scope = d_data->d_scope;
130 d_master->d_restore = d_restore;
131 next = d_restoreChainNext;
132 if (d_data != NULL)
delete d_data;
133 DebugAssert(d_master->d_restore !=
this,
"points to self");
139 #ifdef _CVC3_DEBUG_MODE
140 std::string ContextObjChain::name()
const
143 return d_master->name();
155 Scope* tmpScope = d_scope;
156 DebugAssert(scope < 0 || d_scope->level() <= scope,
158 +
"): scope < d_scope->level() = "
160 d_scope = d_scope->topScope();
163 for(
int i=level(); i>scope; --i) {
164 d_scope = d_scope->prevScope();
166 +name()+
"]: d_scope == NULL");
173 IF_DEBUG(data->setName(name()+
" [copy]");)
175 d_scope->addToChain(d_restore);
187 if(obj->d_restoreChainNext != NULL)
209 : d_cm(cm), d_name(name), d_id(id)
214 TRACE(
"context",
"*** [context] Creating new context: name = "
215 + name +
"id = ",
id,
"");
239 (*i)->d_context = NULL;
247 string indentStr(
level(),
' ');
248 TRACE(
"pushpop", indentStr,
"Push",
" {");
261 IF_DEBUG(DebugCounter maxLevel(debugger.counter(
"max scope level"));)
271 "Illegal to pop last scope off of stack.");
290 string indentStr(
level(),
' ');
291 TRACE(
"pushpop", indentStr,
"}",
" Pop");
314 unsigned long memSelf =
sizeof(
Context);
315 unsigned long mem = 0;
321 return mem + memSelf;
332 d_curContext = createContext(
"default");
338 while (d_contexts.size()) {
339 delete d_contexts.back();
340 d_contexts.pop_back();
347 d_contexts.push_back(
new Context(
this, name, d_contexts.size()));
348 return d_contexts.back();
354 FatalAssert(
false,
"Multiple contexts not yet implemented");
358 d_curContext = context;
367 unsigned long mem = 0;
373 for (
unsigned i = 0; i < d_contexts.size(); ++i) {
374 mem += d_contexts[i]->getMemory(verbosity - 1);
379 return mem + memSelf;