Skip to content

Symbol not getting removed when item is removed from tree #11

Open
@Ineluki

Description

@Ineluki

When items are repeatedly added to and removed from new trees, the symbols stay and start clogging up the memory. Don't know if this is necessary by design or not.

My simple test:

const SymbolTree = require('symbol-tree');

const base = [];
for(let i=0; i<100; i++) {
	base.push({ content: i });
}

for(let i=0; i<1000; i++) {
	let tree = new SymbolTree();
	let root = { root: true };
	base.forEach(obj => {
		tree.appendChild(root, obj);
	});

	let it = tree.childrenIterator(root);
	for( child of it ){
		tree.remove(child);
	}
	console.log(JSON.stringify(process.memoryUsage()));

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions