Skip to content

Commit

Permalink
feat: properly dispose objects and release native memory
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Mooibroek committed Mar 1, 2023
1 parent 2c9c21f commit 8ed2739
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/three3d/core/object_3d.dart
Expand Up @@ -877,7 +877,13 @@ class Object3D with EventDispatcher {
}
}

void dispose() {}
void dispose() {
matrix?.dispose();
matrixWorld?.dispose();
modelViewMatrix?.dispose();
normalMatrix?.dispose();
bindMatrix?.dispose();
}
}

class Object3dMeta {
Expand Down
3 changes: 2 additions & 1 deletion lib/three3d/extras/core/curve.dart
Expand Up @@ -199,7 +199,6 @@ class Curve {
break;

// DONE

}
}

Expand Down Expand Up @@ -344,6 +343,8 @@ class Curve {
}
}

mat.dispose();

return {"tangents": tangents, "normals": normals, "binormals": binormals};
}

Expand Down

0 comments on commit 8ed2739

Please sign in to comment.