Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Headless Cocoa/Java app - autorelease



--- String Larson <email@hidden> wrote:


> 	private doStuff(){
> 		NSImage image = new NSImage(new
> URL("http://someplace...";));
> 		// do stuff w/image.
> 		return;
> 	}
> }
> 
> Everything should be ok (if not right away, at least
> on the next GC), 
> no?
> 

You seem to be assuming java is where the leak
resides? Since this is a bridged NSImage and not a
java image I would tend to assume the other way. The
Cocoa side is probably whats leaking. For Java the
NSImage above is local scope to the doStuff() method,
meaning temporary, and eligible for gc as soon as that
method ends. 
For Cocoa don't reference counts figure into the
object retention somehow? Or should the autorelease
force the object to release irregardless? 
There was mention of problems in synchronizing memory
management across the bridge a while back on java-dev.
I think that concerned retention in some sort of
container like NSDictionary or something. Might be
misremembering. I did locate documentation at the time
indicating that some effort had been put into getting
the memory models to mesh. This indicated to me at
least that where it didn't work could be considered a
bug and rate a bug report. 
After double checking that the object should be freed
by the rules on both sides of the bridge and if I was
pretty sure it wasn't being released I'd most likely
file the bug report.
As per earlier I would not try to wrap JBoss with
Cocoa Java - pretty much period.

Mike Hall 
http://www.spacestar.net/users/mikehall

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Headless Cocoa/Java app - autorelease (From: String Larson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.