<div dir="ltr">Thank you, Ken.<div><br></div><div>This is the reference to the current code in OpenJDK 8: <a href="https://github.com/openjdk/jdk8u/blob/105098218562ce8b62938fb7def2cde918df0b45/jdk/src/macosx/bin/java_md_macosx.c#L1027-L1062">https://github.com/openjdk/jdk8u/blob/105098218562ce8b62938fb7def2cde918df0b45/jdk/src/macosx/bin/java_md_macosx.c#L1027-L1062</a></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 16, 2024 at 10:45 PM Ken Cunningham <<a href="mailto:ken.cunningham.webuse@gmail.com">ken.cunningham.webuse@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">The usual equivalent older construct is this:<br>
<br>
<br>
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];<br>
{<br>
<br>
}<br>
[pool drain];<br>
<br>
<br>
which (AFAIK) does exactly the same thing as:<br>
<br>
@autoreleasepool<br>
{<br>
<br>
}<br>
<br>
but just a little less beautifully.<br>
<br>
Now the commit you referenced has this older construct still in place. But I didn't look at the current source code that you are compiling to see what it has.<br>
<br>
Ken<br>
<br>
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];<br>
{ } [pool drain];<br>
> On Jul 16, 2024, at 7:17 AM, Sergey Fedorov <<a href="mailto:vital.had@gmail.com" target="_blank">vital.had@gmail.com</a>> wrote:<br>
> <br>
> On Tue, Jul 16, 2024 at 6:19 PM Saagar Jha <<a href="mailto:saagar@saagarjha.com" target="_blank">saagar@saagarjha.com</a>> wrote:<br>
> I’m guessing that since the block runs elsewhere there isn’t an autoreleasepool for it anymore. You can probably fix this by wrapping the call to JavaMain in @autoreleasepool {}?<br>
> Saagar Jha<br>
> <br>
> This syntax is not supported by GCC, we need to use a standard ObjC somehow.<br>
> <br>
>> <br>
>> On Jul 10, 2024, at 02:47, Riccardo Mottola via macports-dev <<a href="mailto:macports-dev@lists.macports.org" target="_blank">macports-dev@lists.macports.org</a>> wrote:<br>
>> <br>
>> Hi,<br>
>> <br>
>> Sergio Had wrote:<br>
>>> I have finally built the thing and it works, from looks of things, but I get a message on startup:<br>
>>> 36-25% /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_java_openjdk8/openjdk8/work/jdk8u-jdk8u372-ga/build/openjdk8/images/j2sdk-image/bin/java -version<br>
>>> 2024-07-09 18:34:10.587 java[13785:1903] *** __NSAutoreleaseNoPool(): Object 0x5d12e50 of class NSCFDictionary autoreleased with no pool in place - just leaking<br>
>>> 2024-07-09 18:34:10.590 java[13785:1903] *** __NSAutoreleaseNoPool(): Object 0x5d13310 of class NSCFData autoreleased with no pool in place - just leaking<br>
>>> openjdk version "1.8.0_372"<br>
>>> OpenJDK Runtime Environment (build 1.8.0_372-root_2024_07_09_15_56-b00)<br>
>>> OpenJDK Zero VM (build 25.372-b00, interpreted mode)<br>
>>> <br>
>>> This seems to be related to the code, which upstream has switched to block syntax (it does not build with GCC), so I had to use its earlier version.<br>
>>> From commit message it seems upstream also had this startup issue:<br>
>>> <a href="https://github.com/openjdk/jdk8u/commit/c29d997ca180ba5d812df7745c668cfc906be20b" rel="noreferrer" target="_blank">https://github.com/openjdk/jdk8u/commit/c29d997ca180ba5d812df7745c668cfc906be20b</a><br>
>> <br>
>> the message tells you that you are using NS* objects without an Autorelease Pool. It will cause issues, but "should work", so your app should run.<br>
>> I notice what they appear to be CoreFoundation bridge object. You should try to track where they come from, maybe put a breakpoint and stacktrace.<br>
>> <br>
>> The snipped seen in the commit looks trivial, no nsblocks needed and has an fresh ARP allocated, so I think the issue is elsewhere.<br>
>> <br>
>> Riccardo<br>
> <br>
<br>
</blockquote></div>