HariopaNic
V2EX  ›  问与答

请问我这种写法是否会涉及内存泄露问题?(前端)

  •  
  •   HariopaNic · Aug 23, 2022 · 575 views
    This topic created in 1358 days ago, the information mentioned may be changed or developed.

    ` const demo = () => { const renderAnnotationContent = () => { const arr = [1, 2, 3, 4, 5, 6]; const nodes = arr.map((item) =>

    {item}
    ); return nodes; } return (
    { renderAnnotationContent()}
    ) }

    ` 写的前端项目,碰到了内存溢出问题,目前还没找到是哪些变量没释放 TT 。 请问上面这种写法属于分离 dom 么,渲染完之后 nodes 会被垃圾回收吗?怎么检查是否回收了呢?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6019 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 02:01 · PVG 10:01 · LAX 19:01 · JFK 22:01
    ♥ Do have faith in what you're doing.