• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Headless Cocoa/Java app - autorelease - solution ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Re: Headless Cocoa/Java app - autorelease (From: Michael Hall <email@hidden>)
 >Re: Headless Cocoa/Java app - autorelease - solution ? (From: String Larson <email@hidden>)

  • Prev by Date: Re: NSMailDelivery
  • Next by Date: CoreData: Data freshness vs. multithreading
  • Previous by thread: Re: Headless Cocoa/Java app - autorelease - solution ?
  • Next by thread: Anyone using OCUnit with Tiger/XCode 2.0?
  • Index(es):
    • Date
    • Thread