On Tue, 25 Jan 2022 09:06:49 GMT, Thomas Stuefe <stu...@openjdk.org> wrote:
>> Tyler Steele has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains two commits: >> >> - Merge branch 'master' into JDK-8203290 >> - Implements JFR on AIX >> >> - Implements interfaces from os_perf.hpp in os_perf_aix.cpp >> - Updates libperfstat_aix to contain functionality needed by os_perf_aix >> - Implements missing functionality in loadlib_aix (Fixes failure noted >> by TestNativeLibraies.java) >> - Removes platform checks for --enable-feature-jfr (Now enable-able on >> all platforms) >> - Enables TestNetworkUtilizationEvent.java which now passes on AIX >> - Updates AIX JavaThread::pd_get_top_frame_for_profiling with changes >> from Linux > > src/hotspot/os/aix/os_perf_aix.cpp line 214: > >> 212: // populate cpu_stats && check that the expected number of records >> have been populated >> 213: if (ncpus != libperfstat::perfstat_cpu(&name_holder, all_lcpu_stats, >> sizeof(perfstat_cpu_t), ncpus)) { >> 214: FREE_RESOURCE_ARRAY(perfstat_cpu_t, all_lcpu_stats, ncpus); > > ResourceArray are stack-based arenas. No need to free them manually (freeing > is often a noop anyway unless the allocation is a the top of the arena). Very > similar to those AutoReleasePools in Objective-C, if you know that. > > The way to use them is don't release them. If those allocations don't escape > the function (so, you don't return RA memory from the function), you can set > a ResourceMark at the start of the function. That is an RAII object which > will clear all RA objects allocated in and under this function upon return. > > Arguably, you also could just use malloc and free here (NEW_C_HEAP_ARRAY and > FREE_C_HEAP_ARRAY) This is interesting, and definitely good to know. I have removed all FREE_RESOURCE_ARRAY calls and added a ResourceMark to the top of all procedures which use RESOURCE_ARRAYs. ------------- PR: https://git.openjdk.java.net/jdk/pull/6885