antvis / antvis/G6

[Bug]: the upsert method in base-shape.js may cause memory leak

Open
#6,850 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance refactor
Dominant language
TypeScript
Stars
12.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug / 问题描述

Image

base-shape.ts中的upsert函数只关心新增或已存在的shape,如果渲染过程中shape的key值发生变化,已存在于 shapeMap 上的元素无法被清空

Reproduction link / 复现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤
render() {
  upsert(`key-${Math.random()}`, ..., ...)
}

当每次渲染的shape的className不是相同的,上次渲染的shape就会常驻在shapeMap中,无法被删除和更新

Version / 版本

🆕 5.x

OS / 操作系统
  • macOS
  • Windows
  • Linux
  • Others / 其他
Browser / 浏览器
  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in base-shape.ts and trace the upsert function's handling of shapeMap entries during rendering. Reproduce the issue with a changing key such as key-${Math.random()}, then verify that shapes from earlier renders are removed or updated instead of remaining in shapeMap.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.