Skip to content

Ability to clean memory of static geometries #9985

Closed
@YousefED

Description

@YousefED
Description of the problem

I'm using multiple PlaneBufferGeometry objects. I noticed when creating 10 + meshes based on this, with 255x255 segments, the memory usage can quickly jump to 100mb+.

The memory in use is mainly composed by the .array attribute in the various BufferAttributes. When running:

mesh.geometry.getAttribute("position").array = [];
mesh.geometry.getAttribute("normal").array = [];
mesh.geometry.getAttribute("uv").array = [];

For all meshes, everything still renders fine (and I can freely rotate, etc.). Memory in use drops back to 10mb. I have no intention of altering the geometries after initializing. It feels like a hack though;

  • Is there a recommended way of freeing javascript memory after the attributes have been allocated in webgl?
  • Does my workaround have any downsides? Am I missing something important here?
Three.js version
  • Dev
  • r82
  • ...
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • Linux
  • Android
  • IOS
Hardware Requirements (graphics card, VR Device, ...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions