atom feed20 messages in net.java.dev.rococoa.usersRe: "Invalid memory access" in NSAuto...
FromSent OnAttachments
Duncan McGregorJul 27, 2009 8:48 am 
Michael NagelJul 27, 2009 9:29 am 
Duncan McGregorJul 27, 2009 12:44 pm 
David KocherJul 27, 2009 3:35 pm 
Duncan McGregorJul 27, 2009 3:43 pm 
David KocherJul 27, 2009 4:08 pm 
Andrew ThompsonJul 27, 2009 7:02 pm 
Michael NagelJul 27, 2009 9:28 pm 
Duncan McGregorJul 28, 2009 1:29 am 
Duncan McGregorJul 28, 2009 3:42 am 
Duncan McGregorJul 28, 2009 4:07 am 
Duncan McGregorJul 28, 2009 4:33 am 
Andrew ThompsonJul 28, 2009 4:41 am 
Duncan McGregorJul 28, 2009 5:01 am 
Duncan McGregorJul 28, 2009 11:55 am 
Andrew ThompsonJul 28, 2009 6:17 pm 
Duncan McGregorAug 10, 2009 3:28 am 
Andrew ThompsonAug 10, 2009 8:56 pm 
Duncan McGregorSep 1, 2009 7:59 am 
Andrew ThompsonSep 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(); } }