| From | Sent On | Attachments |
|---|---|---|
| Duncan McGregor | Jul 27, 2009 8:48 am | |
| Michael Nagel | Jul 27, 2009 9:29 am | |
| Duncan McGregor | Jul 27, 2009 12:44 pm | |
| David Kocher | Jul 27, 2009 3:35 pm | |
| Duncan McGregor | Jul 27, 2009 3:43 pm | |
| David Kocher | Jul 27, 2009 4:08 pm | |
| Andrew Thompson | Jul 27, 2009 7:02 pm | |
| Michael Nagel | Jul 27, 2009 9:28 pm | |
| Duncan McGregor | Jul 28, 2009 1:29 am | |
| Duncan McGregor | Jul 28, 2009 3:42 am | |
| Duncan McGregor | Jul 28, 2009 4:07 am | |
| Duncan McGregor | Jul 28, 2009 4:33 am | |
| Andrew Thompson | Jul 28, 2009 4:41 am | |
| Duncan McGregor | Jul 28, 2009 5:01 am | |
| Duncan McGregor | Jul 28, 2009 11:55 am | |
| Andrew Thompson | Jul 28, 2009 6:17 pm | |
| Duncan McGregor | Aug 10, 2009 3:28 am | |
| Andrew Thompson | Aug 10, 2009 8:56 pm | |
| Duncan McGregor | Sep 1, 2009 7:59 am | |
| Andrew Thompson | Sep 1, 2009 6:12 pm |
| Subject: | Re: "Invalid memory access" in NSAutoreleasePool.finalize | |
|---|---|---|
| From: | Duncan McGregor (dun...@oneeyedmen.com) | |
| Date: | Jul 27, 2009 12:44:37 pm | |
| List: | net.java.dev.rococoa.users | |
Thank you Michael, that's very helpful.
Anybody else have an example while I digest what this one means?
D
On 27 Jul 2009, at 17:30, Michael Nagel wrote:
import java.lang.ref.WeakReference;
import org.rococoa.cocoa.NSAutoreleasePool; import org.rococoa.cocoa.NSString;
public class NSAutoreleasePoolThreadTest implements Runnable {
static NSString str; NSAutoreleasePool pool;
public void run() { pool = NSAutoreleasePool.new_();
System.out.println(str.substringFromIndex(4));
pool.release(); }
public static void main(String[] args) { NSAutoreleasePool pool_main = NSAutoreleasePool.new_(); str = NSString.CLASS.stringWithString("teststr");
NSAutoreleasePoolThreadTest arptt = new NSAutoreleasePoolThreadTest();
Thread thread = new Thread(arptt); thread.start(); try { thread.join(); } catch (InterruptedException e) { }
WeakReference<Object> reference = new WeakReference<Object>(arptt.pool); arptt.pool = null;
pool_main.release();
while (reference.get() != null) { System.gc(); } }
}





