Memory leaks when running an apple event
Memory leaks when running an apple event
- Subject: Memory leaks when running an apple event
- From: "Alex Bumbu" <email@hidden>
- Date: Mon, 15 Oct 2007 14:48:58 +0300
Thanx for the reply. I've made the modifications u've recomended to me but
the problem still exists. I've found that the NSAppleEventDescriptor *result
consumes the memory, but if i try to release it the application will crash.
I've tested with this example from apple
http://developer.apple.com/technotes/tn2006/tn2084.html but i'm having the
same problem.
Here is the code i'm using now:
-(void)isAppRunning
{
NSDictionary* errorInfo;
NSAppleEventDescriptor* result;
NSString* appleEventString = [NSString stringWithFormat:@"set
itunes_active to false\n with timeout of 1 second\n tell application
\"Finder\"\n if (get name of every process) contains \"iTunes\" then set
itunes_active to true\n end tell\n end timeout\n return itunes_active"];
NSAppleScript *script = [[NSAppleScript alloc]
initWithSource:appleEventString];
result = [script executeAndReturnError:&errorInfo];
NSLog(@"%@", [result stringValue]);
[script release];
}
-(void)mainProcess:(id)anObject
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
while (1)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[self isAppRunning];
[pool release];
}
[pool release];
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden