some questions on cocoa and java
some questions on cocoa and java
- Subject: some questions on cocoa and java
- From: "Nick Emery" <email@hidden>
- Date: Thu, 04 Oct 2001 08:58:14 +0100
- Organization: Peramon technology Ltd
hi,
i have a small java/cocoa/appkit application which worked fine on 10.0, but fell apart when i upgraded to 10.1.
the problem on 10.1 is that it terminates with a sigsegv or sigabrt after a short (variable) time. this usually means that something cocoa has a reference to a java object that has been garbage collected, and so is a dangling reference.
1) so the question is, for which objects that are used with cocoa must a reference be maintained in the java code?
a) all objects de-archived from a nib file (e.g., all those NSTextField labels)?
b) all objects passed across the appkit api?
c) is there a general rule that applies?
the java docs are entirely unclear on this point.
2) also, i use a separate thread to do some longish processing. the separate thread is used so that the ui remains responsive, and so that the user can interrupt the processing. this separate thread uses events to provoke the main thread to deliver results and manipulate a progress bar (remember, i'm using java so i can't use distributed object etc). in the separate thread, must i use a new autorelease pool? if so, how often should i get a new pool so that the actual objects are released. of course, the only objects that i am allocating are NSEvents...
--nikki
p.s., please don't restart the java vs objc argument as a result of these questions :-)