| … | … | @@ -354,6 +354,7 @@ HandleSet JoinLink::principals(AtomSpace* as, |
| 354 | 354 | // If we are here, the expression had variables in it. |
| 355 | 355 | // Perform a search to ground those. |
| 356 | 356 | AtomSpacePtr scratch = createAtomSpace(as); |
| 357 | scratch->set_copy_on_write(); | |
| 357 | 358 | Handle meet = scratch->add_atom(_meet); |
| 358 | 359 | ValuePtr vp = meet->execute(); |
| 359 | 360 | scratch->clear(); |
| … | … | @@ -604,6 +605,7 @@ HandleSet JoinLink::constrain(AtomSpace* as, bool silent, |
| 604 | 605 | { |
| 605 | 606 | HandleSet rejects; |
| 606 | 607 | AtomSpacePtr scratch = createAtomSpace(as); |
| 608 | scratch->set_copy_on_write(); | |
| 607 | 609 | |
| 608 | 610 | for (const Handle& h : trav.containers) |
| 609 | 611 | { |
| … | … | @@ -83,8 +83,14 @@ void FutureStream::init(void) |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | _scratch = createAtomSpace(_formula[0]->getAtomSpace()); |
| 86 | _scratch->set_copy_on_write(); | |
| 86 | 87 | } |
| 87 | 88 | |
| 89 | FutureStream::~FutureStream() | |
| 90 | { | |
| 91 | // Can't leave the scratch space hanging around... | |
| 92 | _formula[0]->getAtomSpace()->remove_atom(HandleCast(_scratch), true); | |
| 93 | } | |
| 88 | 94 | |
| 89 | 95 | // ============================================================== |
| 90 | 96 |
| … | … | @@ -53,7 +53,7 @@ public: |
| 53 | 53 | FutureStream(const Handle&); |
| 54 | 54 | FutureStream(const HandleSeq&&); |
| 55 | 55 | FutureStream(const ValueSeq&); |
| 56 | virtual ~FutureStream() {} | |
| 56 | virtual ~FutureStream() override; | |
| 57 | 57 | |
| 58 | 58 | /** Returns a string representation of the value. */ |
| 59 | 59 | virtual std::string to_string(const std::string& indent = "") const; |
| … | … | @@ -33,6 +33,8 @@ RelationalValue::RelationalValue(Type t, const Handle& schema) |
| 33 | 33 | |
| 34 | 34 | RelationalValue::~RelationalValue() |
| 35 | 35 | { |
| 36 | // Can't leave the scratch space hanging around... | |
| 37 | _schema->getAtomSpace()->remove_atom(HandleCast(_scratch), true); | |
| 36 | 38 | } |
| 37 | 39 | |
| 38 | 40 | // ============================================================== |
| … | … | @@ -67,6 +69,7 @@ void RelationalValue::init_schema(void) |
| 67 | 69 | // the AtomSpace in which the schema lives, and thus the schema has |
| 68 | 70 | // access to this, to use as context. |
| 69 | 71 | _scratch = createAtomSpace(_schema->getAtomSpace()); |
| 72 | _scratch->set_copy_on_write(); | |
| 70 | 73 | } |
| 71 | 74 | |
| 72 | 75 | // ============================================================== |