mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix more memory leak
This commit is contained in:
parent
f91e474126
commit
3dbee00b0b
6 changed files with 42 additions and 3 deletions
|
|
@ -1545,6 +1545,8 @@ class DtsObject extends GameObject {
|
|||
public override function dispose() {
|
||||
super.dispose();
|
||||
this.level = null;
|
||||
boundingCollider = null;
|
||||
colliders = null;
|
||||
this.dtsResource.release();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -449,8 +449,7 @@ class Marble extends GameObject {
|
|||
|
||||
if (isUltra) {
|
||||
this.rollMegaSound = AudioManager.playSound(ResourceLoader.getResource("data/sound/mega_roll.wav", ResourceLoader.getAudio,
|
||||
this.soundResources), this.getAbsPos().getPosition(),
|
||||
true);
|
||||
this.soundResources), this.getAbsPos().getPosition(), true);
|
||||
this.rollMegaSound.volume = 0;
|
||||
}
|
||||
|
||||
|
|
@ -2123,5 +2122,8 @@ class Marble extends GameObject {
|
|||
if (this.helicopterSound != null)
|
||||
this.helicopterSound.stop();
|
||||
super.dispose();
|
||||
removeChildren();
|
||||
camera = null;
|
||||
collider = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1843,8 +1843,9 @@ class MarbleWorld extends Scheduler {
|
|||
|
||||
if (sky != null)
|
||||
sky.dispose();
|
||||
|
||||
sky = null;
|
||||
instanceManager = null;
|
||||
collisionWorld.dispose();
|
||||
collisionWorld = null;
|
||||
particleManager = null;
|
||||
namedObjects = null;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,15 @@ class CollisionEntity implements IOctreeObject implements IBVHObject {
|
|||
// this.bvh.build();
|
||||
}
|
||||
|
||||
public function dispose() {
|
||||
for (s in this.surfaces)
|
||||
s.dispose();
|
||||
go = null;
|
||||
surfaces = null;
|
||||
bvh = null;
|
||||
octree = null;
|
||||
}
|
||||
|
||||
public function setTransform(transform:Matrix) {
|
||||
if (this.transform.equal(transform))
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -151,4 +151,15 @@ class CollisionSurface implements IOctreeObject implements IBVHObject {
|
|||
n: _transformedNormals[p1]
|
||||
};
|
||||
}
|
||||
|
||||
public function dispose() {
|
||||
points = null;
|
||||
normals = null;
|
||||
indices = null;
|
||||
_transformedPoints = null;
|
||||
_transformedNormals = null;
|
||||
edgeData = null;
|
||||
edgeConcavities = null;
|
||||
originalIndices = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,4 +131,18 @@ class CollisionWorld {
|
|||
this.dynamicOctree.update(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public function dispose() {
|
||||
for (e in entities) {
|
||||
e.dispose();
|
||||
}
|
||||
for (e in dynamicEntities) {
|
||||
e.dispose();
|
||||
}
|
||||
octree = null;
|
||||
entities = null;
|
||||
dynamicEntities = null;
|
||||
dynamicOctree = null;
|
||||
dynamicEntitySet = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue