Hi all,
I'm having a problem with my memory footage, it keeps on increasing even though I have properly released the objects in tight loop. The app will crash with "out of memory error" after some time... I've drilled down the problem to this:
/******************** Begin SimpleObject ***********/
//@interface SimpleObject : NSObject {
//@public
// int iVarA, iVarB;
// int iVarC;
//}
//-(id) init;
//-(void) dealloc;
//@end
//@implementation SimpleObject
//- (id) init { return [super init]; }
//- (void) dealloc {
// // NSLog ( @"SimpleObject dealloc" );
// [super dealloc];
//}
//@end
/******************** End SimpleObject ***************/
NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init];
for ( int i = 0; i < 1000; i++ ) {
// This lead to the same problem
// void *pVoid = malloc( 10000 );
// free( pVoid );
// End This lead to the same problem
SimpleObject *obj = [[SimpleObject alloc] init];
[obj release];
}
[looppool drain]; // whether or not I am using NSAutoreleasePool did not matter at all...
The memory might be fragmented, but shouldn't the OS deal with that problem? besides, there is nothing in between the allocations...
Any thoughts will be highly appreciated. Thanks!