Re: Headless Cocoa/Java app - autorelease - solution ?
Re: Headless Cocoa/Java app - autorelease - solution ?
- Subject: Re: Headless Cocoa/Java app - autorelease - solution ?
- From: Shawn Erickson <email@hidden>
- Date: Tue, 3 May 2005 08:14:08 -0700
Read up on auto-release pools. .
<http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/
Concepts/AutoreleasePools.html#//apple_ref/doc/uid/20000047>
Modified the below...
public class Foo() extends NSPureApplication {
private doStuff(){
int myPool = NSAutoreleasePool.push();
NSImage image = new NSImage(new URL("http://someplace..."));
// do stuff w/image.
NSAutoreleasePool.pop(myPool);
return;
}
public static void main(String[] args){
NSApplication app = NSApplication.sharedApplication();
NSWindow dummy = new NSWindow();
NSGraphicsContext.currentContext().setImageInterpolation
(NSGraphicsContext.ImageInterpolationHigh);
for(cnt = 0;cnt < 10; ++cnt){
doStuff();
}
Object o = new Object();
o.toString(); // place to set a breakpoint ;)
}
}
Also you are not starting the applications runloop so it won't be
attempting to many any auto-release pools or process any events but
in this case that is likely ok ... without knowing what you are
trying to do.
-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden