Skip to content

memory leak when meshes update #263

Closed
@slahser1992

Description

@slahser1992

👋 hi

I want to use react-three-fiber to draw something like this:

elements.map(element =>
<mesh material={elementMaterial}>
<shapeBufferGeometry>
</mesh>
)

when count of elements update, there will generate all new element again and can't dispose old geometry, I try to use useEffect to solve this problem but not work like this:

const map = () => { useEffect(() => { return function ref.current.geometry.dispose() }, []); }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions