Accidental memory leaks

Warp9 was designed to prevent accidental memory leaks, so it is no surprise that it doesn't leak on the same task where Knockout & ReactiveCoffee do.

Details Knockout Reactive Coffee Warp9

In Warp9 information about dependants variables stores not in a variable (like Knockout & ReactiveCoffee) but in a one repository (warp9.core.dag.DAG object), so you can ask the repository how much reactive objects it stores (DAG.length).

Any combinations of 'add', 'inc' and 'clear' and any number of repetitions don't cause memory leak.

JS

var adds = 0;
var handlers = new warp9.Cell(0);
var driver = new warp9.Cell(0);
var items = new warp9.List();

warp9.render(placeholder, ["div",
    ["div", "Known reactive variables: ", handlers],
    ["div",
        ["button", {"!click": function() {
            driver.set(driver.get() + 1);
            handlers.set(warp9.core.dag.DAG.length);
        }}, "inc"],
        ["button", {"!click": function() {
            var offset = adds++;
            items.add(driver.lift(function(driver) {
                return driver + offset;
            }));
            handlers.set(warp9.core.dag.DAG.length);
        }}, "add"],
        ["button", {"!click": function() {
            items.setData([]);
            handlers.set(warp9.core.dag.DAG.length);
        }}, "clear"]
    ],
    ["div", items.lift(function(item){
        return ["div", item];
    })]
]);
handlers.set(warp9.core.dag.DAG.length);