Chrome DevTools,内存:什么是“feedback_cell”以及如何解决追踪到它的内存泄漏?

Chrome DevTools, Memory: what is `feedback_cell` and how to resolve memory leak that traces to it?

在 Chrome DevTools 中测试内存泄漏(在几个 attach/detach jQuery 插件之后)我发现有一些增量对象,但我无法理解它们的性质:

什么是 feedback_cell 关于哪些报告 DevTools?我的代码中没有这样的标识符(此处 BsMultiSelect.js)。

行号指向方法定义:function staticContentGenerator(...) { 我猜 feedback_cell 是来自内部 js 结构的东西,但我找不到任何关于它的东西。

如何处理这样的痕迹?

遇到了同样的问题,但这篇文章帮助我理解了什么是 feedback_cell

https://rohitwhocodes.wordpress.com/2020/08/20/feedback-vectors-in-heap-snapshots/

TLDR;

  • feedback_cell不是内存泄漏的原因
  • feedback_cell(也称为反馈向量)是v8引擎为了优化执行性能而维护的元数据信息数组。

How do feedback vectors affect memory investigations?

They are a red herring and if you see a feedback_cell in the retainer list that you are investigating, you can safely assume this specific retainer list is not the cause of the leak.

You can think of feedback vectors are soft references and hence it is safe to ignore them as a cause of a memory leak.

更新:正如塞巴斯蒂安在评论中所说

  • 如果你认为你没有内存泄漏,但你仍然看到这些feedback_cell,这意味着你确实有内存,但它不是由这些引用引起的