On 12/9/09 1:52 AM, Henri Häkkinen said: >I was under the impression that automatic garbage collection was used in >Mac OS X 10.5 and over, so retaining and releasing objects was handled >automatically?
Mostly automatic. :) >This is the initializer method of my Mesh class (I'm using OpenCTM >library for importing triangle meshes): > >- (id)initWithContentsOfFile:(NSString *)path >{ > self = [super init]; > if (self) { > // Create an OpenCTM context and load the mesh from disk. > CTMcontext context = ctmNewContext(CTM_IMPORT); > ctmLoad(context, [path UTF8String]); > > // Check OpenCTM errors. > CTMenum error = ctmGetError(context); > if (error != CTM_NONE) { > NSLog(@"OpenCTM error while opening %@: %s (%d)", path, > ctmErrorString >(error), error); > ctmFreeContext(context); > [self dealloc]; > return nil; > } > > // Store the geometry arrays. > _vertices = [NSData dataWithBytes:ctmGetFloatArray(context, > CTM_VERTICES) > > length:ctmGetInteger(context, CTM_VERTEX_COUNT) * sizeof >(CTMfloat[3])]; > > _indices = [NSData dataWithBytes:ctmGetIntegerArray(context, > CTM_INDICES) > > length:ctmGetInteger(context, CTM_TRIANGLE_COUNT) * sizeof >(CTMuint[3])]; And these are ivars I guess? If so, they should live as long as 'self' does. Do you use the 'bytes' method? Are you aware of the issues with it under GC? -- ____________________________________________________________ Sean McBride, B. Eng s...@rogue-research.com Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com