| From | Sent On | Attachments |
|---|---|---|
| David Kocher | May 31, 2009 8:52 am | |
| Duncan McGregor | Jun 2, 2009 4:42 am | |
| David Kocher | Jul 16, 2009 3:46 am | .png |
| Duncan McGregor | Jul 16, 2009 8:48 am | |
| Duncan McGregor | Jul 17, 2009 2:43 am | |
| David Kocher | Jul 17, 2009 5:14 am | |
| Duncan McGregor | Jul 17, 2009 1:09 pm | |
| David Kocher | Jul 17, 2009 3:10 pm | |
| Duncan McGregor | Jul 17, 2009 3:14 pm | |
| David Kocher | Jul 17, 2009 4:04 pm |
| Subject: | Re: alloc leaking without autorelease | |
|---|---|---|
| From: | David Kocher (dkoc...@cyberduck.ch) | |
| Date: | Jul 17, 2009 3:10:54 pm | |
| List: | net.java.dev.rococoa.dev | |
Great, I didn't expect I could remove that workaround so quickly :)
~David
On 17.07.2009, at 22:10, Duncan McGregor wrote:
I've just checked in a set of changes to address this issue. The autorelease shouldn't be needed, but was working around a bug where I was retaining object's returned from methods like alloc.
I'm afraid that the change will mean that you'll have to regenerate your classes without the autorelease, otherwise the pool will now cause the count to go to 0 when it is drained.
D
On 17 Jul 2009, at 10:44, Duncan McGregor wrote:
I guess that this shows the problem
@Test public void test() { assertRetainCount(1, Rococoa.create("NSObject", NSObject.class)); assertRetainCount(2, NSObject.CLASS.alloc()); }
We're gaining a count somewhere that the pool is removing when it is drained.
Now that I'm standing in the hole, I'll keep digging.
D
On 16 Jul 2009, at 11:47, David Kocher wrote:
Checking this with Instruments I can verify that it *is* needed. If e.g. we use a NSLayoutManager using the factory method
public static NSLayoutManager layoutManager() { return CLASS.alloc().init(); // return Rococoa.cast(CLASS.alloc().init().autorelease(), NSLayoutManager.class); }
then NSLayoutManager is reported to be leaking but not when the commented-out code is used instead. Attached the screenshot from Instruments. How could we wrap this into a testcase to prove?
~David
On 02.06.2009, at 19:14, Duncan McGregor wrote:
BTW I don't think that the generated factory code needs to autorelease viz: return Rococoa.cast(CLASS.alloc().initWithTitle (title).autorelease(), NSMenu.class); as NSObject should retain its id for the lifetime of the Java object. Getting rid of the autorelease would then allow the cast to go.
<Picture 12.png>






.png