From 38b0ad95ad16b07072e26b93307fc8d8955cc963 Mon Sep 17 00:00:00 2001 From: Jens Ayton Date: Sat, 22 Sep 2012 14:20:20 +0000 Subject: [PATCH] Clean up intermediate Geometry objects immediately after creating octrees. git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@5351 127b21dd-08f5-0310-b4b7-95ae10353056 --- src/Core/OOMesh.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Core/OOMesh.m b/src/Core/OOMesh.m index 18eb98fc..1097df6a 100644 --- a/src/Core/OOMesh.m +++ b/src/Core/OOMesh.m @@ -661,13 +661,17 @@ static NSString *NormalModeDescription(OOMeshNormalMode mode) { if (octree == nil) { - octree = [OOCacheManager octreeForModel:baseFile]; + octree = [[OOCacheManager octreeForModel:baseFile] retain]; if (octree == nil) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + octree = [[self geometry] findOctreeToDepth:[self octreeDepth]]; + [octree retain]; [OOCacheManager setOctree:octree forModel:baseFile]; + + [pool release]; } - [octree retain]; } return octree;