Browse Source

[as3] Fixed memory leak in Triangulator

badlogic 8 years ago
parent
commit
11b402fcaf

BIN
spine-as3/spine-as3-example/lib/spine-as3.swc


+ 6 - 0
spine-as3/spine-as3/src/spine/Triangulator.as

@@ -175,6 +175,9 @@ package spine {
 					if (polygon.length > 0) {
 						convexPolygons.push(polygon);
 						convexPolygonsIndices.push(polygonIndices);
+					} else {
+						polygonPool.free(polygon);
+						polygonIndicesPool.free(polygonIndices);
 					}
 					polygon = Vector.<Number>(this.polygonPool.obtain());
 					polygon.length = 0;
@@ -250,6 +253,9 @@ package spine {
 				if (polygon.length == 0) {
 					convexPolygons.splice(i, 1);
 					this.polygonPool.free(polygon);
+					polygonIndices = convexPolygonsIndices[i];
+					convexPolygonsIndices.splice(i, 1);
+					this.polygonIndicesPool.free(polygonIndices);
 				}
 			}
 

BIN
spine-starling/spine-starling-example/lib/spine-as3.swc


BIN
spine-starling/spine-starling/lib/spine-as3.swc