Release canvas memory faster
This commit is contained in:
@@ -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>}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user