summaryrefslogtreecommitdiff
path: root/src/expr/node_manager.cpp
diff options
context:
space:
mode:
authorTim King <taking@cs.nyu.edu>2010-03-23 19:41:49 +0000
committerTim King <taking@cs.nyu.edu>2010-03-23 19:41:49 +0000
commite11bce2790fa9e517e08ae5d3c477da651db3630 (patch)
treeffc4bb7cab3a6887c83fd3817c4cd79503d53a2c /src/expr/node_manager.cpp
parent9576517676138a8ca2887a967f1b056662ef6754 (diff)
Fixed some memory cleanup and destruction issues with ContextObj, ECData, CDList, and CDMap. Added the d_underTheShotgun field to NodeManager to keep track of which NodeValue is currently being deleted. If a Node or TNode has this node value, it can always be deleted. This avoids the need for introducing SoftNodes. Currently passes Debug and Production make check
Diffstat (limited to 'src/expr/node_manager.cpp')
-rw-r--r--src/expr/node_manager.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/expr/node_manager.cpp b/src/expr/node_manager.cpp
index 7b171a48b..ee370f682 100644
--- a/src/expr/node_manager.cpp
+++ b/src/expr/node_manager.cpp
@@ -61,6 +61,19 @@ struct Reclaim {
}
};
+struct NVReclaim {
+ NodeValue*& d_reclaimField;
+ NVReclaim(NodeValue*& reclaim) :
+ d_reclaimField(reclaim) {
+
+ Debug("gc") << ">> setting NVRECLAIM field\n";
+ }
+ ~NVReclaim() {
+ Debug("gc") << "<< clearing NVRECLAIM field\n";
+ d_reclaimField = NULL;
+ }
+};
+
void NodeManager::reclaimZombies() {
// FIXME multithreading
@@ -104,6 +117,8 @@ void NodeManager::reclaimZombies() {
if(nv->getKind() != kind::VARIABLE) {
poolRemove(nv);
}
+ NVReclaim rc(d_underTheShotgun);
+ d_underTheShotgun = nv;
// remove attributes
d_attrManager.deleteAllAttributes(nv);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback