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

透视表渲染10w+的单元格内存持续飙升(可能内存泄漏)浏览器崩溃 #2710

Closed
1 task
Azhi-ux opened this issue May 10, 2024 · 2 comments · Fixed by #2728
Closed
1 task
Assignees
Labels
next 2.0-next 版本的问题

Comments

@Azhi-ux
Copy link

Azhi-ux commented May 10, 2024

🏷 Version

Package Version
@antv/s2 2.0.0-next.19

Sheet Type

  • PivotSheet

🖋 Description

image 这里为什么要一下子处理所有单元格的宽高呢,在这里很容易直接内存oom;

image

而且拖拽列头依然会执行到这块方法;内存持续飙升;

image

还有官网事例

⌨️ Code Snapshots

🔗 Reproduce Link

🤔 Steps to Reproduce

😊 Expected Behavior

期望能关注内存占用的问题

😅 Current Behavior

💻 System information

Environment Info
System Mac: 14.1
Browser Chrome: 124.0.6367.92
@github-actions github-actions bot added the next 2.0-next 版本的问题 label May 10, 2024
@Azhi-ux Azhi-ux changed the title 透视表渲染10w+的单元格内存持续飙升(可能内存泄漏)浏览器崩溃🐛 透视表渲染10w+的单元格内存持续飙升(可能内存泄漏)浏览器崩溃 May 10, 2024
@wyh888
Copy link

wyh888 commented May 13, 2024

这里是因为每一次重新布局都会重新绘制文本,计算行头的高度,我这边临时的解决方案是覆写 getRowNodeHeight 方法,可以参考下:

import { PivotFacet } from "@antv/s2";

export class PivotFacetSetter extends PivotFacet {
  constructor(spreadsheet) {
    super(spreadsheet);
  }

  // 自定义行头节点高度
  getRowNodeHeight() {
   // ...
    return this.spreadsheet.options.style?.rowCell?.height || 30;
  }
}

options 中:

const options = {
  facet: sheetType === 'pivot' ? (spreadsheet) => new PivotFacetSetter(spreadsheet) : null,
}

@Azhi-ux
Copy link
Author

Azhi-ux commented May 13, 2024

这里是因为每一次重新布局都会重新绘制文本,计算行头的高度,我这边临时的解决方案是覆写 getRowNodeHeight 方法,可以参考下:

import { PivotFacet } from "@antv/s2";

export class PivotFacetSetter extends PivotFacet {
  constructor(spreadsheet) {
    super(spreadsheet);
  }

  // 自定义行头节点高度
  getRowNodeHeight() {
   // ...
    return this.spreadsheet.options.style?.rowCell?.height || 30;
  }
}

options 中:

const options = {
  facet: sheetType === 'pivot' ? (spreadsheet) => new PivotFacetSetter(spreadsheet) : null,
}

好的,感谢大佬,我试试🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next 2.0-next 版本的问题
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants