V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
HariopaNic
V2EX  ›  问与答

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

  •  
  •   HariopaNic · Aug 23, 2022 · 565 views
    This topic created in 1355 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   ·   4642 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 10:05 · PVG 18:05 · LAX 03:05 · JFK 06:05
    ♥ Do have faith in what you're doing.