Bug Description
In TreeStore.#rebuildKeysAndCount(), an array _keys is allocated and assigned to the store instance (me._keys = new Array(len)). This array is only used locally within this method to populate the internal map and is never read or used anywhere else in the Collection or TreeStore lifecycle. Because it is bound to the instance, it persists indefinitely, causing an unnecessary memory leak that grows with every bulk projection (like expandAll or filter).
Solution
Remove the assignment to me._keys and use a local variable instead to prevent the memory leak.
#rebuildKeysAndCount() {
let me = this,
items = me._items,
len = items.length,
keys = new Array(len),
{map} = me;
map.clear();
for (let i = 0; i < len; i++) {
let key = me.getKey(items[i]);
keys[i] = key;
map.set(key, items[i])
}
me.count = len
}
Bug Description
In
TreeStore.#rebuildKeysAndCount(), an array_keysis allocated and assigned to the store instance (me._keys = new Array(len)). This array is only used locally within this method to populate the internalmapand is never read or used anywhere else in theCollectionorTreeStorelifecycle. Because it is bound to the instance, it persists indefinitely, causing an unnecessary memory leak that grows with every bulk projection (likeexpandAllorfilter).Solution
Remove the assignment to
me._keysand use a local variable instead to prevent the memory leak.#rebuildKeysAndCount() { let me = this, items = me._items, len = items.length, keys = new Array(len), {map} = me; map.clear(); for (let i = 0; i < len; i++) { let key = me.getKey(items[i]); keys[i] = key; map.set(key, items[i]) } me.count = len }