Release canvas memory faster

This commit is contained in:
ahocevar
2019-01-21 22:43:36 +01:00
parent b6d115d868
commit e37734826c
6 changed files with 31 additions and 13 deletions
+11
View File
@@ -169,6 +169,17 @@ export const defaultLineWidth = 1;
export const labelCache = new LRUCache();
/**
* Prune the label cache.
*/
export function pruneLabelCache() {
while (labelCache.canExpireCache()) {
const canvas = labelCache.pop();
canvas.width = canvas.height = 0;
}
}
/**
* @type {!Object<string, number>}
*/