Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #1892

Merged
merged 2 commits into from
Jan 17, 2025
Merged

Release #1892

merged 2 commits into from
Jan 17, 2025

Conversation

wang1212
Copy link
Member

No description provided.

* fix: memory leak caused by function cache

* chore: update test snapshot
Copy link

Walkthrough

This pull request addresses a memory leak issue in the @antv/g-lite package by implementing a cache clearing mechanism. It introduces a clearCache function to the memoize utility, ensuring that caches are cleared during the destruction process of the Canvas component.

Changes

Files Changed Summary
.changeset/wise-birds-begin.md Added a changeset note for a patch fix addressing a memory leak caused by function cache.
packages/g-lite/src/Canvas.ts Integrated memoize.clearCache() in the destroy method to clear caches when a Canvas is destroyed.
packages/g-lite/src/utils/memoize.ts Added cacheList and clearCache function to manage and clear memoization caches.
tests/integration/snapshots/* No changes in snapshot files.

@@ -352,6 +353,8 @@ export class Canvas extends EventTarget implements ICanvas {
* @param skipTriggerEvent - whether to skip trigger destroy event
*/
destroy(cleanUp = true, skipTriggerEvent?: boolean) {
memoize.clearCache();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that memoize.clearCache() is called appropriately to prevent any unintended cache clearing that might affect other parts of the application.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@wang1212 wang1212 merged commit 9af3612 into next Jan 17, 2025
4 checks passed
@wang1212 wang1212 deleted the release branch January 17, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant