Memory leak in case if BinOM Variable referenced from child node
gbytegear opened this issue · comments
using namespace literals;
Variable array = arr{ true, false, i8(-8), 8_ui8, i16(-16), 16_ui16, i32(-32), 32_ui32, .32_f32, i64(-64), 64_ui64, .64_f64};
array.toArray() += arr{false, true, array.move()};
utils::printVariable(array);
// FIXME:
// If you don't delete the variable-reference to the parent element,
// then the memory from under the resource will not be freed!
array.toArray().popBack();
In resource deleting operation required to make child-nodes crawler for references to parent node counting. Then calculate difference between calculated references to parent node and current value of reference counter in deletable node. If difference is zero - delete nodes structure. Provide for the case child node have been refernced from structure other branch and he contained refernce to deletable parent node - in that case parent node can't be deleted.